Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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 12 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.