
Security Fundamentals
Obfuscation 101: Unmasking the Tricks Behind Malicious Code
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
A Node 4.x compatible ES2015 alternative to left-pad
$ npm install es-leftpad
leftpad = require('es-leftpad')
leftpad('foo', 5)
// => " foo"
leftpad('foobar', 6)
// => "foobar"
leftpad(1, 2, 0)
// => "01"
Performance compared to left-pad
using benchmark.js
leftPad x 1,420,504 ops/sec ±0.45% (92 runs sampled)
es-leftPad x 4,607,534 ops/sec ±1.31% (91 runs sampled)
Padding to 8 ("999", 80, "0")): Fastest is es-leftPad
leftPad x 2,602,721 ops/sec ±0.94% (89 runs sampled)
es-leftPad x 5,120,414 ops/sec ±0.58% (93 runs sampled)
Padding to 8 ("999", 40, "0")): Fastest is es-leftPad
leftPad x 6,310,671 ops/sec ±0.53% (92 runs sampled)
es-leftPad x 5,318,553 ops/sec ±0.72% (92 runs sampled)
Padding to 12 (999, 12)): Fastest is leftPad
Passing all tests from left-pad/test.js
FAQs
An ES2015 alternative to left-pad
The npm package es-leftpad receives a total of 2 weekly downloads. As such, es-leftpad popularity was classified as not popular.
We found that es-leftpad 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 Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
Security News
Biome's v2.0 beta introduces custom plugins, domain-specific linting, and type-aware rules while laying groundwork for HTML support and embedded language features in 2025.