
Lodash v3.0.0 - gitspirit
https://lodash.com/?v3
======
astalwick
We switched from underscore to lodash several months ago, and haven't
regretted it. The fact that lodash follows semver is huge. Underscore has
introduced serious breaking changes in minor point-releases more than once,
which is completely unacceptable for a utility library.

~~~
untog
Semver isn't a requirement nor be-all-end-all, though.

~~~
cmpb
It is, however, amazingly convenient and capable of saving a lot of time in
bug fixes.

------
allendoerfer

      The lodash & lodash-compat npm packages now come with modules baked in too.
      Perfect for Browserify!
    
      // load the modern build
      var _ = require('lodash');
      // or a method category
      var array = require('lodash/array');
      // or a method
      var chunk = require('lodash/array/chunk');
    
    

This is great. It combines trust and quality with modularity.

------
tobr
Really nice to see that there's now an auto-curried, function-first version,
lodash-fp! I've been really attracted by Ramda JS recently for this reason.

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

~~~
rikkus
I've been looking for some real-world examples of how currying might be useful
in javascript. Haven't not used a language which supports currying for any
real world project, I'm interested to know how it can help.

I found a page [1] which talks about currying in javascript, then says "Are
there practical uses for currying in JavaScript? Not really."

Can you point me at anything which will help me see why it's useful?

[1] [http://benalman.com/news/2012/09/partial-application-in-
java...](http://benalman.com/news/2012/09/partial-application-in-javascript/)

~~~
albertkawmi
This slideshow [1] by one of the authors of Ramda.js goes over a JavaScript
example in OO style and refactors it to functional style. Currying is used to
complete the refactoring.

I've linked to the slides on currying but you'll need to back up to follow the
whole example.

[1]
[http://scott.sauyet.com/Javascript/Talk/FunctionalProgrammin...](http://scott.sauyet.com/Javascript/Talk/FunctionalProgramming/#slide-70)

~~~
drapper
Wow, thanks, that presentation is pure gold! The best thing about FP (and
moving into it from the OOP world) I've ever seen: clear, easy to follow,
based on a practical example and really presenting the sense behind the use of
FP.

------
olivierkaisin
See release notes and changelog: \-
[https://github.com/lodash/lodash/releases/tag/3.0.0](https://github.com/lodash/lodash/releases/tag/3.0.0)
\-
[https://github.com/lodash/lodash/wiki/Changelog](https://github.com/lodash/lodash/wiki/Changelog)

~~~
bsimpson
I dig laziness, but why is `forEach` lazy? That's the only one that invokes
immediately in libraries like Lazy.js.

~~~
quadratini
It's only lazy if it's part of a chain

------
Sarien
Q: "What does it do?"

A: "A utility library delivering consistency, modularity, performance, &
extras."

Q: "Yeah, but what does it do?"

A: "Oh, nothing but it does it consistently, modularly and performant. We also
have functions for string handling in the extras module."

~~~
nailer
It's extra stuff that should be in the standard library but isn't.

These days, a lot of it is actually in the standard library - for example,
array maps - and invoking lodash just calls the es5/es6 built in, with a
slightly uglier syntax.

~~~
acjohnson55
But if you want backward compatibility, you still probably want to use
something like Lodash. I'd also argue that Lodash's/Underscore's interface is
far better thought out than the standard library. The standard library has so
many absurd gotchas, like `["2", "2", "2", "2"].map(parseInt)`. The verbosity
of Javascripts lambdas also makes composition of simple parts more arcane
looking than necessary, and having a whole bunch of composable/chainable
utility functions does a lot to help people write self-documenting code.

~~~
nailer
> But if you want backward compatibility, you still probably want to use
> something like Lodash.

A few years ago, sure, but these days I'd use es6-shim. The code will be
shorter, have more documentation around the internet, and when old browsers
die you won't have to change anything to be on standard JS.

~~~
jdd
lodash offers features and performance over es5/6 built-ins.

------
Elrac
I followed the link and saw "lodash" for the first time today. Oh, it's a
library! With an API! In various formats!

I always appreciate it when the top of the project page provides a one-liner
explaining just what it is I'm looking at.

~~~
falcolas
I wish that it had mentioned what it was a library for. Took me longer than it
should have to identify that it was a Javascript library.

I probably should have guessed, but I hate guessing wrong and missing out on
something I could really use.

------
acjohnson55
Lodash is an incredible accomplishment, and having it vastly improves the
Javascript authorship process over the standard library.

That being said, I still can't believe we don't have a flatMap:

[https://github.com/lodash/lodash/issues/812](https://github.com/lodash/lodash/issues/812)
[https://github.com/jashkenas/underscore/issues/452](https://github.com/jashkenas/underscore/issues/452)
(Underscore repo, but still Mr. Dalton, author of Lodash, opposing.)

~~~
invisible
He explained how to add a flatMap in 2 lines in the first linked issue. It
sounds pretty trivial to add per app.

------
urza
It is alternative to underscore.js? Or extensions for underscore.js? Not clear
from the page...

~~~
woah
It's supposed to be better, faster, and stronger (more functions) than
underscore.

It's also under active maintenance from an enthusiastic dev. Do your own
research, but I go with lodash.

~~~
jsprogrammer
Lazy.js claims to be even faster than both with support for lazy evaluation to
boot. Not quite a drop-in replacement like lodash is, but I think it only
requires a minor tweak.

~~~
killercup
A new feature in 3.0 is that lodash now supports lazy evaluation using the
chaining API from 2.x.

~~~
masklinn
So 2.0 code which used chaining is now broken if it doesn't explicitly exhaust
the chain?

------
sgrove
I've been playing around with getting Mori[0] more js-like, from more
idiomatic function names and argument order (fn as the last argument,
released) to playing around with a chaining API. Ideally we should be able to
wrap javascript values, manipulate via idiomatic chaining (similar to Lodash),
while getting most of the benefits from highly-tuned persistent data
structures, lazy sequences, etc.

e.g.

    
    
        expect(_([1,1,1,1,2,2,3,4,5,6,6]).distinct().conj(7).out()).toEqual([1,2,3,4,5,6,7]);
    
    

Here's a small set of specs showing early ideas
[https://github.com/swannodette/mori/blob/8e82b15b35b2989d4a2...](https://github.com/swannodette/mori/blob/8e82b15b35b2989d4a2d5d74c6a23f5bf779ea2f/spec/chain-
spec.js)

[0] [https://github.com/swannodette/mori](https://github.com/swannodette/mori)

------
andrezsanchez
I've tended to avoid both underscore and lodash because they're both in the
slew of monolithic pre-npm libraries, however the lazy evaluation looks
interesting. I wouldn't be surprised to find a library that handles lazy eval
without all the extra features Lodash brings.

~~~
jgalt212
For the shops who don't live and breath js and whose js work is almost
entirely browser-based, these monoliths are great. I, for one, am bummed that
the js market is moving away from monoliths. e.g. YUI shutting down.

~~~
andrezsanchez
That's an interesting perspective. I don't have any inherent problems with
large libraries, but my problem with some of these 'monoliths' is that other
libraries start to depend on the entire library when they only need a small
piece of functionality that the library provides.

Substack wrote an article [1] explaining some of the problems that monolithic
libraries cause in an ecosystem.

[1] [http://substack.net/many_things](http://substack.net/many_things)

~~~
jgalt212
thanks, I'll check that out.

------
jtheory
Whoah: "Tested in Chrome 39-40, Firefox 34-35, _IE 6-11_ , Opera 25-26, Safari
5-8"...

IE6+ support! I wonder if that's real, full support, or more like a "there are
serious bugs we'll probably never fix for old IE".

Working with old IE versions is loathsome (but still required for some of us),
so libraries that just work there are much appreciated.

~~~
jdd
Yap it's tested in IE6 & full support.
[https://saucelabs.com/u/lodash](https://saucelabs.com/u/lodash)

------
edwardg
For anyone interested in learning more about lodash, Adam Boduch's "Lodash
Essentials" book just got released, and covers everything in v3 (he delayed it
to make sure it covered v3).

[https://www.packtpub.com/web-development/lo-dash-
essentials](https://www.packtpub.com/web-development/lo-dash-essentials)

------
ecaron
The changelog at
[https://github.com/lodash/lodash/wiki/Changelog](https://github.com/lodash/lodash/wiki/Changelog)
gives some nice examples of breaking changes for anyone moving from v2.x

------
sosuke
So going modern means breaking in PhantomJS, that is a bummer.

~~~
jdd
It doesn't mean it's breaking in PhantomJS. The modern build lacks some
iteration fixes for older environments is all. In the case of PhantomJS it's
edge iteration of things like `arguments` objects. The modern build won't
error out even in IE6.

------
tieTYT
It's not clear to me: Is that list at the bottom new things in v.3?

------
picardo
Is there build of this that lets me require a single function?

~~~
insin
Every function is published to npm as a module:
[https://www.npmjs.com/browse/keyword/lodash-
modularized](https://www.npmjs.com/browse/keyword/lodash-modularized)

------
facepalm
Is this the same as underscore.js?

~~~
msl09
[http://stackoverflow.com/questions/13789618/differences-
betw...](http://stackoverflow.com/questions/13789618/differences-between-
lodash-and-underscore)

~~~
facepalm
Thanks - it sounds as if you could use it as a drop in replacement for
underscore.

~~~
Pephers
Yes, you can. I've successfully done so in a Backbone/React app.

The _.chain() method furthermore gives a nice functional style ways of
building lists which is useful when building UI in React, like so:

    
    
        var list = _.chain([1, 2, 3, 4, 5])
            .filter(function (value) {
                return value > 2;
            })
            .map(function (value) {
                return value;
            });
    
        console.log(list);
    
        // prints:
        // [3, 4, 5]

~~~
masklinn
That's not "furthermore". chain/value also exists in underscore.

Also your code was broken in Lodash 2 (it'd return a lodash object, not a
list) and is _more broken_ in Lodash 3 (chains are now lazy), so your code
does just about nothing until you force the iterator's evaluation)

~~~
jdd
lodash v2 offers an Underscore build that aligns its chaining and other API
with Underscore providing a full drop-in replacement. However because lodash
is a superset of Underscore those using the Underscore build lose out on
additional methods, optimizations, & cross environment fixes.

Over the last year Underscore has align more & more with lodash’s API so the
need for a separate Underscore build has diminished. If you still need
compatibility around some of the edges you should leverage modules in lodash
v3 to supplement your Underscore use until the time you can drop Underscore
completely.

------
mackwic
Already submitted:
[https://hn.algolia.com/?query=lodash&sort=byPopularity&prefi...](https://hn.algolia.com/?query=lodash&sort=byPopularity&prefix&page=0&dateRange=last24h&type=story)

Seems like no one cares. Strange.

~~~
arcatek
I use Lodash but i see not point in this announcement in its current form -
what changed exactly?

[edit] Changelog is there
[https://github.com/lodash/lodash/wiki/Changelog](https://github.com/lodash/lodash/wiki/Changelog)

Some decisions sound really weird, such as the fact that forEach is now lazy.
It is not a standard replacement anymore, and probably break the compatibility
for quite a few apps (even if I'm deeply convinced that we should all use the
native functions and shim them when needed).

~~~
jkrems
It's only lazy when using the chaining syntax - and that one was never a
standard replacement since `_.map(arr, fn)` returns a wrapper around a value
and not a value.

