top | item 44245585

(no title)

nicou | 8 months ago

For context, see https://en.wikipedia.org/wiki/Npm_left-pad_incident

discuss

order

HPsquared|8 months ago

11 lines of code! Wow. I had no idea it was that small.

xnorswap|8 months ago

There used to be the general wisdom of, "Don't re-invent the wheel. Let the hive-mind craft utility functions and use those because they'll be battle-hardened, well tested, and you can focus on your core business".

I think the left-pad incident helped shatter that myth. He we had huge packages depending on a package which padded a string in an inefficient manner.

It turns out that the many eyeballs of the bazaar had averted their gaze from what was actually happening, which is a system of impossible to audit dependency chains.

I think it also shows the impact of using a language with a poor standard library.

Padding is absolutely something that should be available as an extension over String.

If JavaScript were controlled in the same manner that Go, Rust, Java, .NET, python etc, then it would have been added years ago.

Apparently it has now finally arrived in ES2026: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

rootlocus|8 months ago

> Most of my open source work followed Unix philosophy, so the packages did one thing at a time. There was 350+ of them.

The man page for a unix binary is at least two orders of magnitude larger. At some point, the "Unix philosophy" doesn't make sense anymore. I mean, it couldn't even rightpad.

ThinkBeat|8 months ago

oh there are thousands of those out there on npm. Short and trivial code. Even if you do not use them at all in your own codebase chances are quite high that some package you do use, uses some of those tiny packages.