Updating the libraries in premise
Taking on dependencies for these one-liners is just nuts. Just ask the React team how well their week has been going, and whether they wish they had written those 11 lines for left-padding a string themselves.
Follow David Haney on Twitter at @haneycodes Updated Jan 13 2017 with some minor grammar and sentence structure changes.
Here are some of the things that I observed: All of this leads me to wonder…
On what possible plane of existence is this a better solution to past problems?
Things like a database access layer (ORM) or caching client should be dependencies because they’re complicated and the risk of the dependency is well worth the savings and efficiency.
Second, even if the package’s logic is correct, I can’t help but be amazed by the fact that developers are taking on dependencies for single line functions that they should be able to write with their eyes closed.
In my opinion, if you cannot write a left-pad, is-positive-integer, or is Array function in 5 minutes flat (including the time you spend Googling), then you don’t actually know how to code.
Any of these would make a great code screening interview question to determine whether or not a candidate can code.
As you are probably already aware, this week React, Babel, and a bunch of other high-profile packages on NPM broke.
The reason they broke is rather astounding: A simple NPM package called left-pad that was a dependency of their code.