fill-number
Version:
Fill the front of a number with the chosen padding.
29 lines (16 loc) • 405 B
Markdown
Fill the front of a number with the chosen padding. Default is zero. Build with __nan__.
```sh
npm i fill-number
```
```js
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'
```