Duplicate code across the ecosystem is fine. Not every function must be unique for an entire programming language.
And the behavior could also be worse, there is no guarantee of perfection.
The last argument is too generic to offer any guidance. Why is it better for this function be duplicated?? Should it not be part of std to avoid uniqueness?
> > > > (assuming the standard library doesn't include one already)
I don't need left-pad.
But maybe I need react-starter-kit.
Now, imagine that react-starter-kit has a dependency to markdown-js-blobber, which has a dependency to make-text-nice, which has a dependency to left-pad.
In this scenario I am now "pulling in a package to pad a string". If I am "smart enough to use a package manager", I should be "more than capable to write..." an alternative to react-starter-kit..?
Combine this to mainstream education teaching that you should always reuse code when possible instead of "reinventing the wheel", and web shops agreeing to it because "using libraries saves time", and it's easy to understand the "popularity" of left-pad.
To a certain extent, and to the best of my knowledge, those things haven't really changed.
I don’t think such small packages are sensible, in particular when versioned separately, but I also don’t see how the left-pad debacle has shown that.