
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend 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} character
digits('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.
The npm package digits receives a total of 43 weekly downloads. As such, digits popularity was classified as not popular.
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.