Skip to content

zachlatta/right-pad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

right-pad

right-pad replaces Math.floor, Math.ceil, and Math.round with much more apt implementations. right-pad, like left-pad, may break your dependencies.

Math.floor(10.5);
// =>
//     │
//     │
//     │
//     │
//     │
//     |_____10.5_____

Install

$ npm install zachlatta/right-pad

Usage

require('right-pad');

Math.floor(10.5);
// =>
//     │
//     │
//     │
//     │
//     │
//     |_____10.5_____

Math.ceil(10.5);
// =>
//     _____10.5_____
//     |
//     │
//     │
//     │
//     │
//     │

Math.round(10.5);
// =>            x x x x x
//           x x           x x
//         x                   x
//       x                       x
//       x                       x
//     x                           x
//     x                           x
//     x         1 0 . 5           x
//     x                           x
//     x                           x
//       x                       x
//       x                       x
//         x                   x
//           x x           x x
//               x x x x x

Math.pow(10.5);
// =>         ,--.--._
//     ------" _, \___)
//       POW!  / _/____)  ( 10.5 )
//             \//(____)
//     ------\     (__)
//            `-----"

Math.random();
// => 7

Math.log(10.5);
// =>    ____________  
//      / \    ~   /.\ 
//     | o | 10.5 |  o|
//     |0 .| ~  ~ | 0 |
//      \_/________\_/ 


Math.abs(0);
// =>                        ,▄▓▓▓▓▓▓▓▓▓▓▓▓▒░░╬Θ░⌂    ░░░░-                            
//                        ,▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌╣╣░░░░⌂ ░░░░░░░░░░░░░⌐                     
//                     ╓▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒╣░░░░░░ ░░░░░░░⌂    '░░░                   
//                  ,▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌╬░░░░░░░░░░░░░░░░⌐   ⌂⌂░░░⌐                 
//               ,╗▒▓▌▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▌╬╢▀╣╣░░░░░░░░░░⌂⌂░░░░░░⌂░⌂░░░░░╖                
//            ,▒▓▓▒╣╬╬╬╬╬╢▒▓▓▓▓▓▓▓▓▌▒▒╬░░╬╬░░░░░░░░░░░⌂ ⌂░░░░░░░░░░░░░░                
//           ╓▓▓▓▌▒╣╣╬╣╬╬╢▒▒▒▒▒▒▒▒▒▒╣╬░░░╬╬░░░░░░░░░░░░⌂░░░░░░░░░░░░░░░╢               
//          ╓▓▓▓▓▓▌▒▒╣╣╢╢╢╣╣╣╣╣╣╣╣╣╬╬╬░░░╬╢╣╣░░░░░░░░░░░░░░░░╣▒▒▒╣╬╬░░░╣╖              
//          ▓▓▓▓▓▓▓▌▒▒▒▒╣▒╣╣╣╣╣╬╬╬╬╬╬░░░░░╢╬╣░░░░░░░░░░░░░░░░╠▓▀δδ░░░╬╣░░╢             
//          ▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒╣╣╣╬╬╬╬╬░░░░░░░╢╣╬░░░░░░░░░░░░░░░╬▓▓▒▒░░░░░░░░░░⌐           
//          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌▒▒╣╣╬╣╬░░░░░░░░╫▓▒▒╣╬░░░░░░░░░░╬▒▒▓▓▓▌▒╣░░░░░░░░░╕          
//          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒╣╣╣╬╣╬░░░░░╬╫▓▓▓▌▒╣╣╣░░░░░╬▒▒▒╬╬▓▓▓▓▒╣░░░░░░░░░          
//         ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒╣▒▒▒▒▒▒▓▓▓▓▓▓▓▌▒▒▒▒▒▒▓▌▒╬╣▒▒▀╙█▓▒▒╬░░░░░░░╣         
//        ]▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▀δδ▀▓▓▓▓▓▓▓▓█▓▌▀▒░░╬╬╢▀   ▀▓▌▒╣╣╬░░░░░╕        
//        ▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▌╬░░░░░▒▌▒╬╬░░╬╢╬╬░░░░╬╬▒     Σ▓▓▓▒╣▒╣░░░╣        
//        ▓▓▓▓▓▓▓▓▓▓▓▓▌ ╙█▓▓▓▓▓▓▓▓▓▓▌▒▒▒╣╣╢╣▒▓▓▒▒╣╬╬░░░░░░░░╣⌐       █▓▓▓▓▒╬░░░╬       
//        ▓▓▓▓▓▓▓▓▓▓▓▓     █▓▓▓▓▌▒╣▒╬╬╬╬░░░╬╢╫▌╣░░░░░░░░░░░░╬         ╙▓▓▓▌╬░░░░╢      
//        ▓▓▓▓▓▓▓▓▓▓▓Γ     ╘▓▓▓▓▓▓▓▒▒╣╣╬░░░░░║▓▒╬░░░╬╣╢╣╣╬╬╬╢          ╟▓▓▌╬░░░░░╕     
//       ╓▓▓▓▓▓▓▓▓▓▓▀       ▓▓▓▓▓▓▓▓▓▌▒▒▒▒╣╣░╣▓▓▒▒▒╣▒▒╬╬δ▒╣╬╣          ╙▓▓▒╣╬░░░╬╢     
//       ▓▓▓▓▓▓▓▓▓▓▌        ▓▓▓▓█▓▓▓▀██▀╣░░░░╬╣╬░░░░░░╬░░░░╣▒           ▓▓▒╣╬░░░░╬Q    
//      ▓▓▓▓▌▓▓▓▓▓▓         ▓▓▌▒╬╠▓▓▒▒╣╬╬░░░╬╢▌▒╣░░░╬╬╬░░░░░╣           ║▓▓╣╬░░░░╬▒    
//     ]▓▓▓▒╣╢▒▓▓▓▌        ╫▓▓▒╣╬╬█▓▓▓▒╣╬╬╬░░▒▌▒╬╬╬╣╢╬░░░░░░░╦           ▓▓▌╣╬░░░╬▒    
//     ╟▓▓▌▒╣╣╢╣╣▒▌        ▓▓▓▒╣╣╬╢▒▒▒╬╬╬░░╠▒╣▀▒╬╬╣╬░░░░░░░░░╣           └▓▓▒╬╬░░╬╢    
//     ╟▓▓▓▒╣╣╣╣▒▒Θ        ▓▓▓▌▒╣╬╬▒▌▒╣╣╣╬░░░╬╬░░░░░░░░░░░░░╬▒            ╚▓▌╣╬░░╬╢    
//     ▓▓▓▓▌▒╣╢╣╣▒⌐       ]▓▓▓▓▓▒╣╬╬▒▒▒╣╣╣╢╬╣╣╣╣╬╬╬╬░░░░░░╬╢╣▒             ▀▓▒╬░░╬╢    
//     ▓▓▓▓▌▒╣╣▒▒▌       ╒▓▓▓▓▓▓▓▌▒╬╢▒▒▒╣╣╣╬╬╢╣╣╣╬╣╬░▄▄▄▄▓▓▓▓▓▓▌            ▓▌╬░░╬╢    
//     ╟▓▓▓▓▒▒▒▒▓▒       ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓            ▐▓▒░░╢╬

License

right-pad is licensed under the MIT license. See LICENSE for the full text.

This was a late night, sleep deprived idea of Michael Hulet

About

Make math utility functions great again

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •