Javascript library/toolkit modularisation do not goes this way. Mout, async or lodash are using a proper scheme to require('just/thefuction/youneed') and it's fine (no rollup will ever be needed). Polluting npm with dozen of one-liner is not a good idea (never forget left-pad)
In NPM registry, yes. But in Node.JS ecosystem, it was left-pad's scope
combined with inability of the community to adopt seasoned sysadmins' tools,
like custom repositories to build artifacts without ever needing to touch
network (which is somewhat difficult to execute when you have dozens to
hundreds of dependencies for a trivial project).
I don't think the number of dependencies per individual project is a critical factor when setting up an internal npm mirror for all your projects (e.g. with Nexus [1] where I work) or vendoring dependencies per project (e.g. `npm shrinkwrap --dev && shrinkpack` [2]) - you're either doing it or you aren't.
> 2. (logic) A term of a statement, where the statement may be true or false depending on whether the thing referred to by the values of the statement's variables has the property signified by that (predicative) term.
> 3. (computing) An operator or function that returns either true or false.
It is valid to simply point out mistakes like these. It only takes a few seconds of effort, a few mins to fix and move on from. Instead we want to make this simple statement an emotional battleground and berate OP for not doing the author's brainwork.
I'd say it makes no such assumption - in fact it tells the reader that it's not valid. The reader may then choose to educate him or herself as necessary.
Highlighting a factually incorrect statement is not criticism. Criticism assumes a different point of view. Granted he could have put it as a GitHub issue, but how about we avoid anti-intellectualism.
I think being part of a discussion sometimes requires some basic knowledge of the basic. Otherwise, if you need every concept explained to you, well, it's not a discussion, but a lecture. After all, if I deem it common knowledge and you do not, how do I know where is the limit of your knowledge base?
IMHO, people in the technical industry should first try to find knowledge by themselves, and ask only when it is not easily accessible. If you keep asking questions which you can find answers by Googling, hmm, how do you even survive in this industry? That is, if you're not in management, of course.
This fails to recognize that the smallness of npm modules is intimately related to the proliferation of dependencies. The idea behind the node module-design paradigm is that packages should be small and many, instead of large and few like (for example) in C++. That makes sense because you only use what you need, but it kind of falls apart because the "small" packages you import carry with them 50 other "small" packages. Also because you lose the shortcut for vetting your dependencies which is to vet the people who wrote them. That's a half-assed approach to vetting code you rely on, but the alternative seems to be to do nothing at all.
So these modules are small, but anything that uses them is going to contribute to the proliferation of dependencies just as much as ever.
If you wrapped that "unique" implementation in some kind of reusable construct, it would be even easier to use, and it would be easy to replace with a more efficient implementation. Hmm.
I would cheerfully argue that repeating non obvious code that could easily be wrapped in a documented function with an obvious name raises technical debt considerably more than causing someone to briefly wonder what a function called 'unique' that operates on an array does.
All of these are available in Lodash, both as one package with no dependencies and a plethora of individual micropackages with very small dependencies.
When I looked at pulling in a "micropackage" from Lodash it had so many dependencies that had dependencies (3-4 levels deep sometimes) that instead of being ~15-20 lines of JavaScript at most, it ended up being 300-400 lines, if I remember correctly.
Ended up writing my own mini-routine instead. If I ever need enough of Lodash to care I'll just import the whole thing, which is the only way to get lazy evaluation anyway.
Crap. I've already banished Babel from my toolchain -- the Babel ES6 shim throws a warning in Firefox about modifying the prototype of an object, and from what I can tell that will kill or limit both V8 and SpiderMonkey optimizations from that point on.
Back to plan A: Don't use Lodash in client code unless I'm willing to use the whole thing (so that I can get the chaining optimizations, which cherry picking doesn't support anyway).
Here is the author's motivation:
"It felt wrong installing half of npm even for basic utilities, so I made JUST, a family of dependency-free modules" [1]
Something i can relate to. It just feels wrong to do a npm install for something very basic and see half a linux installation happening in the console...
It does nothing to address the underlying issue of people relying on NPM packages where there is little-to-no developer maturity to do with stable APIs and ongoing support.
I'll never criticise anyone for releasing OSS but ultimately he just becomes the things that half of NPM relies on and the vicious cycle continues.
I applaud the concept, but also don't have too many qualms about installing lodash's single function packages, since they typically only have a couple of requirements and are battle tested.
JavaScript has always been uniquely tied to the web, where page load times matter and serving a bunch of unnecessary data to a user can have a significantly negative impact. I think there is a balance to be struck with how we architect our libraries. In fact, ES6 module imports already go a long way in addressing these issues. Take a look at http://rollupjs.org for how efficient module bundling can be done through the use of ES6
Somebody wanted to write code in a particular way and extended the language with a couple of utilities for doing so, then decided to publish it for others to use.
What's the purpose of having a module like just-template when ES6 already supports templated strings? The only difference I see based on the example is that instead of using a template string literal, you call a function with an additional data argument.
I don't get it. Does array-last* has any sense? If someone needs to include a package for last() so the code is more bugproof and stable, I don't know what to expect in more complex algorithms..
This, like many stuff I see in the javascript world, is overegineering.
Can't put the blame of one bad package on the whole community. If there is a bad package don't use it. I've seen lots of well engineered packages with zero dependencies.
E.g typescript. Entire compiler and language server. No dependencies.
Es6 is a decent library out of the box. I always only add a dependent if it's something not trivial.
A lot of the shitty packages came out before tree shaking was a thing.
There is an argument. Should you just have a large hash table of functions that you reference. Those in the bandwagon go for the one function packages.
Well, what browsers you support is obviously going to depend strongly on your particular site and use case. I work on a consumer-facing site for a national broadcaster which sets very aggressive browser support (oldest IE we support is IE11) which works fine for us.
Regardless, any sort of environment where you can do `import extend from 'just-extend';` is going to (have a way) support map and filter.
>> Regardless, any sort of environment where you can do `import extend from 'just-extend';` is going to (have a way) support map and filter.
That is not true for the now-fairly-common use case that browserify/webpack satisfy. I write code with ES6 module syntax and build with browserify (& babelify) to target the browser. But I still need to pull in modules like lodash.map/lodash.filter if I want to target IE8.
(I could use es5-shim but that makes for less portable code).
Because then you can curry/partially apply functions independent of your data.
It's _not_ because it's convention everywhere else.
(I realize that only really makes sense if you know why it makes sense, so this video gives a pretty good explanation in ~30 minutes - https://www.youtube.com/watch?v=m3svKOdZijA)
* https://github.com/caolan/async/blob/master/CHANGELOG.md
* http://moutjs.com/