
Company News
Socket Has Acquired Secure Annex
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.
Pad numbers with zeros. Automatically pad the number of digits based on the length of the array, or explicitly pass in the number of digits to use.
Pad numbers with zeros. Automatically pad the number of digits based on the length of the array, or explicitly pass in the number of digits to use.
npm i digits --save
npm test
var digits = require('digits');
Left pad the given value with the specified number of zeros or alternate character.
value {String}number {String}returns {String} characterdigits('abc', 10);
//=> '0000000000abc'
digits('abc', 10, '~');
//=> '~~~~~~~~~~abc'
Pad left pad each value in the given array to align with the longest item/number in the array. Zeros are used by default, but a custom character can be passed as the second argument.
arr {Number}: The array of values to pad.len {Number}: Amount to pad the number.returns {String}: Padded numberExample
digits.each([1, 100, 1000])
//=> ['0001', '0100', '1000']
digits.each([a, bb, ccc], ' ')
//=> [' a', ' bb', 'ccc']
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert
Released under the MIT license
This file was generated by verb on December 05, 2014. To update, run npm i -g verb && verb.
FAQs
Pad numbers with zeros. Automatically pad the number of digits based on the length of the array, or explicitly pass in the number of digits to use.
We found that digits demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.