# left-pad npm package

9 Hacker News commenters recommended left-pad npm package and 26 criticized it, November 2025 to November 2026. It was recommended in 6 of 13 months.

**Verdict:** Tiny npm package that pads strings to a set length, filling a gap JavaScript lacked at the time. Critics call it an unnecessary dependency for trivial code.

## Why people recommend it

- Filled gap in JavaScript's standard library (2 comments): "isarray and left-pad are at least functions that didn't used to be in the standard library" ([source](https://news.ycombinator.com/item?id=49739511)) "it did one thing that js didn't natively do" ([source](https://news.ycombinator.com/item?id=49785333))
- Widely downloaded and depended on (2 comments): "imagine where the JavaScript ecosystem would be if packages like is-array and left-pad couldn't get accepted to npm" ([source](https://news.ycombinator.com/item?id=47954601)) "Even left-pad is still getting 1.6 million weekly downloads." ([source](https://news.ycombinator.com/item?id=47585578))

## What people warn about

- Trivial code not worth a dependency (5 comments): "There seem to be a lot of packages for extremely trivial things that nonetheless gets huge amounts of downloads" ([source](https://news.ycombinator.com/item?id=46352827)) "Check out left pad or the two dozen other "utility" packages that could be done in a single line of code." ([source](https://news.ycombinator.com/item?id=48372316)) "Left-pad was 11 lines of code. Literally no reason to pull in an external dependency for that." ([source](https://news.ycombinator.com/item?id=45840068))
- Breaks installs when removed from npm (2 comments): "It was famous for bringing down everyone's npm installs a few years ago." ([source](https://news.ycombinator.com/item?id=49785315)) "left thousands of packages broken when it was taken off npm" ([source](https://news.ycombinator.com/item?id=50318301))
- Edge-case bugs with multi-character padding (2 comments): "Both old and new versions return a string longer than `len` if the padding char is multiple characters" ([source](https://news.ycombinator.com/item?id=48064007)) "The infamous leftpad library didn't handle certain edge doses properly." ([source](https://news.ycombinator.com/item?id=48058370))
- Discourages writing simple code yourself (4 comments): "People are trying to shove as much shiny tools as possible instead of sometimes writing 10 vanilla JS lines" ([source](https://news.ycombinator.com/item?id=46496317)) "projects were importing a one-liner package and blindly using it, which requires no skill" ([source](https://news.ycombinator.com/item?id=50156640)) "it was always a better idea to build your own instead of depending on that" ([source](https://news.ycombinator.com/item?id=46776599))

## Alternatives hackers recommend

- [jQuery](https://hackerapproved.com/p/jquery.md): 111 recommend
- [Picknplace.js](https://hackerapproved.com/p/picknplace-js.md): 58 recommend
- [Alpine.js](https://hackerapproved.com/p/alpine-js.md): 50 recommend
- [Effect (TypeScript library)](https://hackerapproved.com/p/effect.md): 38 recommend
- [Video.js](https://hackerapproved.com/p/video-js.md): 24 recommend

## Cite as

Hacker Approved, "left-pad npm package", https://hackerapproved.com/p/left-pad/ (counts from 1,795,640 Hacker News comments, November 2025 to November 2026).
