
“Discuss latest changes to master before releasing” - ChrisGaudreau
https://github.com/jashkenas/underscore/issues/2061
======
ggreer
If you find yourself annoyed by some aspects of Underscore, you might want to
check out Lodash[1]. Lodash's API is a superset of Underscore, though you can
create custom builds with only the parts you need. In general, Lodash performs
better and has fewer bugs than Underscore. Unlike Underscore, Lodash has 100%
test coverage. Also, Lodash has some handy things like _.cloneDeep(), and
semantic versioning. That means your package.json can have "lodash": "3.x" in
its dependencies without worrying about breakage.

For a more in-depth discussion of the differences between Lodash and
Underscore, I recommend Ben McCormick's _Underscore vs Lo-Dash_ [2].

1\. [https://lodash.com/](https://lodash.com/)

2\. [http://benmccormick.org/2014/11/12/underscore-vs-
lodash/](http://benmccormick.org/2014/11/12/underscore-vs-lodash/)

~~~
maratd
Lodash is also several times larger than Underscore. The point of Underscore
is to keep it light.

And yes, you can pick and choose what modules you want. But you could do that
with Mootools and it was released a decade ago. If you want a heavy framework
with lots of modules, there are plenty to choose from.

Maybe if it offered a light version on the front page? The file linked from
the front page is 372KB. By comparison, the file linked from Underscore's
front page is 51KB.

~~~
TheAceOfHearts
If you're using CommonJS you can do require('lodash/category/method'), and
when it gets built on the frontend it'll only include the method and its
dependencies. So if you're using only 5% of lodash, you'll only get that 5%.

~~~
maratd
Right. If on node, you can also use modules via NPM (
[https://www.npmjs.com/browse/keyword/lodash-
modularized](https://www.npmjs.com/browse/keyword/lodash-modularized) ).

But as I said, this is common in many frameworks. Hell, you can even do with
JQuery ( [http://projects.jga.me/jquery-
builder/](http://projects.jga.me/jquery-builder/) ). So having this ability
doesn't make Lodash special.

This is not presented as the preferred method to use the framework on the
project page either. You just get a link on the front page to the whole
shebang. Probably because most developers just download the whole thing and
stick it in.

What I was really hinting at was code complexity. Sometimes having something
light and small that you can stick in there without worrying about anything is
useful. Lodash can address that by having a light version linked off their
front page, but they haven't done that.

On top of everything, Underscore is ribbing them on this very point. See
[http://underscorejs.org/](http://underscorejs.org/) and bit down "(3x smaller
than Lodash ;)" in bold. Seems like a really easy point to address.

~~~
jiaweihli
If you care about filesize, you'll probably optimize as much as possible. You
can do this with Lodash using modular imports.

There's little upside in hosting a light version, and fragmenting the docs.
Min/max'ing on filesize lets you save 15 kB, or 0 kB. Creating a light build
that saves 5 kB is a maintenance cost with a poor ratio relative to reward.

~~~
maratd
> If you care about filesize

I don't care about filesize. I care about code complexity. The more crap you
add to a page, the slower it will run. You also get a higher probability of
conflicts and problems in the long run.

If you need something, you need something. But if you don't and you just throw
it in there, you're asking for problems down the road.

~~~
jdd
For an example of cherry-picking lodash modules see

[https://github.com/postaljs/postal.js/issues/91#issuecomment...](https://github.com/postaljs/postal.js/issues/91#issuecomment-73159144).

------
javajosh
I like Ramda[1] better than both underscore or lodash because of it's argument
ordering (function first) and auto-currying[2]. It's 7kb minified and gzipped.

[1] [http://ramdajs.com/](http://ramdajs.com/)

[2] [https://buzzdecafe.github.io/code/2014/05/16/introducing-
ram...](https://buzzdecafe.github.io/code/2014/05/16/introducing-ramda/)

~~~
Touche
[https://www.npmjs.com/package/lodash-
fp](https://www.npmjs.com/package/lodash-fp)

Don't know how they compare though.

~~~
jdd
Yap, lodash v3
([https://github.com/lodash/lodash/releases/tag/3.0.0](https://github.com/lodash/lodash/releases/tag/3.0.0))
introduced lodash-fp for auto-curried iteratee-first lodash methods.

------
untog
To be fair: Underscore doesn't follow semver, so breaking changes between
versions should be expected. This thread just seems like an excuse to pile on
jashkenas and promote lodash.

~~~
abritishguy
It is released and consumed via 2 package managers that _mandate_ the use of
semver.

------
brandoncarl
Via the Lodash CLI you can "lodash underscore". This results in 6.7kb gzipped.
In my experience, jdalton is a very solid coder and the lodash package is
excellently maintained.

------
logicallee
I don't follow Underscore but whoever wrote this title (currently "Underscore
1.8 makes last minute breaking changes to master without discussion") must
really have an axe to grind, and it seems inappropriate for HN. Doesn't really
set the tone for any constructive discussion.

~~~
wcummings
Yeah, and linking to a PR risks a bunch of parties w/o a real stake in the
project piling on and shitting up the PR. Really poor form, OP.

~~~
sutro
_shitting up the PR_

Good people of HN, this phrase deserves your upvotes.

------
christopherscot
what idiot is using Underscore at this point?

------
omouse
Welcome to JavaScript.

