|
|
|
|
|
by Klathmon
3605 days ago
|
|
This is the major part of the whole "left-pad" fiasco I don't get. If there is a well written, well tested, and widely used micro-library out there that does one thing and does it very well, why not use it? Even if you think you can re-implement it in 5 minutes, will yours be as fast? Will yours be as well tested? Will yours have an interface that many other developers already know and use? Sometimes reinventing the wheel is needed, but most of the time using a well working wheel that someone else made is the best choice. |
|
Because every dependency comes with a cost. First of all, it needs to be available and the author might decide to pull it - maybe not from npm, but from github. Second is a matter of trust: Someone just needs to take over the left-pad authors npm account an all of a sudden he can inject arbitrary code into all projects using the dependency. I'd bet that 90% of folks don't even bother to check the left-pad code. So basically you need to trust each and every author of dependencies that they're benevolent and competent, that is: They don't drop the ball, get hacked, loose access, ... And that task gets harder and harder the more dependencies you have to vet. In a lot of instances just inlining the code would be better. A larger stdlib that can be selectively included would be better. It's a tough problem and npm just sits on an extreme end of the scale.