Zeropad your positive integers.
For custom-length zeropadding, see zeropad.
$ npm install simple-zeropad
var zeropad = require('simple-zeropad');
zeropad(9);
// => '09'
zeropad(0);
// => '00'
zeropad(10);
// => '10'
Amazing, right?
This is an incredibly simple module, but I have lost count over the years how many times I have written a function to zeropad my numbers for various user-interface purposes, so the motivation to build this module is one of pure principle, posterity, and a mission to modularize. Please enjoy this module and the 20 seconds of blood, sweat and tears I poured into this.
- zeropad: pad to any custom length
MIT @ Michael Wuergler