fill-number
v1.0.2
Published
Fill the front of a number with the chosen padding.
Downloads
10
Maintainers
Readme
fill-number
Fill the front of a number with the chosen padding. Default is zero. Build with nan.
Install
# With npm
npm i fill-number
How to use
const fillNumber = require('fill-number');
fillNumber(3, 1) // ~> '001'
fillNumber(5, 2) // ~> '00002'
fillNumber(4, 1, '#') // ~> '###1'
fillNumber(4, 20, '#') // ~> '##20'
fillNumber(4, 20, ' ') // ~> ' 20'