zero-fill

v2.2.4
Zero-fill a number to the given size.
zero zero fill fill zerofill pad 0 zero pad zeropad string and 2 more...

zero-fill travis npm downloads javascript style guide

Zero-fill a number to the given size.

zero

install

npm install zero-fill

usage

var zeroFill = require('zero-fill')

zeroFill(4, 1) // '0001'
zeroFill(10, 55) // '0000000055'
zeroFill(1, 1) // '1'

Partial application:

zeroFill(4)(1) // '0001'

Custom padding character:

zeroFill(4, 55, ' ')  // '  55'
zeroFill(4, 500, ' ') // ' 500'

license

MIT. Copyright (c) Feross Aboukhadijeh.

npm i zero-fill

Metadata

  • MIT
  • Whatever
  • Feross Aboukhadijeh
  • released 7/17/2020

Downloads

Maintainers