
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
FastPad is a blazing fast left-pad function with performances better than pad-left and the new native function repeat (Present in the new ES6 and Node 6).
The algorithm is the Egyptian string concatenation algorithm found in the British museum by researchers a while ago.
Even though pad-left is very fast, I've done it better by caching the result as well as there is no need to redo the math if the input is the same as the cached input.
$ npm install fastpad --save
var pad = require('fastpad');
console.log(pad('0',4,'4'));
On a small scale, the execution time for a single record is 5 microseconds compared to 6 microseconds which the famous pad-left has.
Below you can see some benchmark results ( each test was ran 100 times ):
PAD That returns 0004
pad('0',4,4) Result: 2.000.000 ops / 48 miliseconds
pad('0',4,'4') Result: 20.000.000 ops / 439 miliseconds
pad('0',4,4) Result: 200.000.000 ops / 3.9 seconds
PAD That returns 000000test
pad('0',10,'test') Result: 200.000.000 ops / 4.2 seconds
FAQs
Fastest pad left implementation, 2 millions ops in 48ms.
The npm package fastpad receives a total of 9 weekly downloads. As such, fastpad popularity was classified as not popular.
We found that fastpad 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.