3 ms·
This is what a lot of non-JavaScript languages do. I suspect JavaScript ended up this way because people wanted to avoid downloading anything they absolutely d
by PeCaN 11y ago
This is what a lot of non-JavaScript languages do.
I suspect JavaScript ended up this way because people wanted to avoid downloading anything they absolutely didn't need in the browser. Now packagers can automatically remove unused functions (WebPack 2 does this IIRC, and I think require.js did ages ago) so it's no longer a concern but somehow NPM still ended up with a million tiny libraries.
Thank god Underscore/lodash didn't use the approach of one-module-per-function.
- Macha 11y agoone-module-per-function is exactly the approach Lodash uses and the Lodash devs tout is as a big advantage over underscore. The difference is they also provide the rollup bundle with all of Lodash. Which is what most users actually use.
- sotojuan 11y agoYep, that's what I meant. It's one module per function (so I can just grab what I want), but it's all part of a big project under a good maintainer, so it's trustable.