Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The issue with npm is JS doesn't have a stdlib, so developers need to rely on npm and third party libs even for things stdlib provide in languages like Java, Python, Go, ...




Sure it does. The JS standard library these days is huge. Its way bigger than C, Zig and Rust. It includes:

- Random numbers

- Timezones, date formatting

- JSON parsing & serialization

- Functional programming tools (map, filter, reduce, Object.fromEntries, etc)

- TypedArrays

And if you use bun or nodejs, you also have out of the box access to an HTTP server, filesystem APIs, gzip, TLS and more. And if you're working in a browser, almost everything in jquery has since been pulled into the browser too. Eg, document.querySelector.

Of course, web frameworks like react aren't part of the standard library in JS. Nor should they be.

What more do you want JS to include by default? What do java, python and go have in their standard libraries that JS is missing?


When people say "js doesn't have a stdlib" they mean "js doesn't have a robust general purpose stdlib like C++ or ${LANGUAGE_ID_RATHER_BE_USING}."

But of course it fucking doesn't because it's a scripting language for the web. It has what it needs, and to do that it doesn't need much.


> When people say "js doesn't have a stdlib" they mean "js doesn't have a robust general purpose stdlib like C++ ...

It does though! The JS stdlib even includes an entire wasm runtime. Its huge!

Seriously. I can barely think of any features in the C++ stdlib that are missing from JS. There's a couple - like JS is missing std::priority_queue. But JS has soooo much stuff that C++ is missing. Its insane.


That's what I assume people mean, because they can't mean trivial stuff like "left-pad" and "is-even" because why would that be part of any language's standard library?


Weird that the JS community relies entirely on external libraries with arbitrarily deep and fragile dependency trees that default fail to wrecking the entire web because JS "doesn't have a stdlib" for this sort of thing then. ¯\_(ツ)_/¯

It is. Though in their defence, I think this api was added after the leftpad fiasco.

Also not many people seem to know this, but in the aftermath of leftpad being pulled from npm, npmjs changed their policy to disallow module authors from ever pulling old packages, outside a few very exceptional circumstances. The leftpad fiasco can’t happen again.


JS has a stdlib, so to say. See nodejs, and Web standard.

And no programming language's stdlib includes e. g. WhatsApp API libraries




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: