
Lodash 4.0.0 is out - bpierre
https://github.com/lodash/lodash/releases/tag/4.0.0
======
krat0sprakhar
Kudos to John-David Dalton for making such an awesome lib and being such a
positive force behind it for so long! I've reached out to him multiple times
on Twitter and he's always been quick to help!

He should definitely write a post on how he stays productive and motivated to
work day-in and day-out on one project. Really inspiring!

~~~
hccampos
Indeed, John-David Dalton, together with Dan Abramov and others have been
great in the JS community. Kudos!

~~~
kentcdodds
You'll be interested to know that Dan Abramov is on the JavaScript Air panel.
This is relevant because of this:
[https://news.ycombinator.com/item?id=10909199](https://news.ycombinator.com/item?id=10909199)
:-)

------
conradk
Feels good to see a JS lib last that long and still be actively maintained,
deprecating obsolete features and adapting to the new ways we use our browsers
without breaking BC (or else explaining how to migrate).

Coming from Symfony (PHP), this just feels right: keep moving but make it easy
to follow along.

~~~
patates
Is this a Symphony thing or are external dependencies significantly more
reliable in the PHP ecosystem in general? Last time I wrote PHP was 9 years
ago and those times everyone I knew just copy-pasted all the external code
they found. I know that package managers are the thing now and I'm using nuget
for my .NET projects (and npm, which is a must if you do any front-end dev),
however, I feel like I'm having more dependency management issues than the
good ol'days in spite of using a language with static type checking.

I'm not saying "vendor everything" but maybe _some_ vendoring helps,
especially when every package author seems like they've taken the philosophy
of "doing one thing, doing it well and breaking everything on every update".

~~~
dchesterton
I find external dependencies much more reliable in the PHP world than JS. Most
packages try to follow semver. Composer is one of the best dependency manager
tools I've used and you can easily lock down dependency versions so you can
install from a state which you know works.

People hate on PHP but there are a lot of quality packages out there and
Composer is definitely considered best practice by most developers now.

------
johnhenry
I remember reading sometime ago that the creators of LoDash strived to
maintain drop-in compatibility with Underscore, and that if breaking changes
between the two libraries were to occur, an announcement would be made. I
can't find the initial statement, so I wonder if the developers are still
attempting to maintain this?

~~~
ben336
There are some small incompatibilities:
[https://github.com/lodash/lodash/wiki/Migrating](https://github.com/lodash/lodash/wiki/Migrating)

They're still mostly drop in though, most lodash differences are extras rather
than modifications.

------
overcast
I think it's time to check out a jquery alternative. My recent projects are
basically only using deep copies and some semi-complex selectors. lodash +
querySelector should cover pretty much everything at this point.

~~~
krat0sprakhar
Have you checked out Lea Verou's Bliss.js?
[http://blissfuljs.com/](http://blissfuljs.com/) It's super minimal and
basically relies on querySelector. Give it a whirl and see if it fits your
needs.

~~~
overcast
Cool! I'll check it out thanks. Deep Clone is required though, I'll poke
around.

~~~
pygy_
lodash.cloneDeep is available as a standalone npm module (as are all lodash
functions).

It clocks at 2.5KB mingzipped, after browserification.

There are probably lighter implementations.

------
techterrier
The FP stuff is huge. I've been using Ramda which is great, but often feel
like I'm out on a limb with it.

~~~
jgord
upvote for Ramda, which I happily use everyday ( be it on server or front end)

------
HNcow
Not sure if this is a dumb question but I haven't been able to find an answer
anywhere.

I currently use underscore 1.8.3. Can I just swap lodash in, or is refactoring
involved? I know it's a fork, and I want to move over, but was curious if
anyone know off the top of their heads if a lot of work as involved.

~~~
kevindeasis
I'll put this here just in case no one comments.

[https://lodash.com/docs#forEach](https://lodash.com/docs#forEach)

[http://underscorejs.org/#each](http://underscorejs.org/#each)

~~~
johnhenry
If I'm correct, you're showing this as a counter example to prove that the two
have incompatible APIs and are thus LoDash can't be used ad a drop in
replacement. However, Lodash does alias it's 'forEach' function with 'each',
so this wouldn't be an issue?

~~~
ksherlock
underscore.each has an optional 3rd parameter (context). lodash.each does not.
If you depend on that 3rd parameter, you will be in a world of pain if you
drop-in lodash. In fact you'd be better off if there was no alias because you
would catch the problem sooner and have to think about the API differences
when fixing it.

~~~
9point6
To be fair, that context parameter has only just been removed as part of
4.0.0. Instead they recommend you change your code to be of the form:

    
    
        _.each(collection, _.bind(function, context))
    

Which actually seems a lot more correct than some arbitrary context parameter

~~~
vkjv
How is it arbitrary? It's part of the ES spec.

[https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Refe...](https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)

I'm honestly curious why this is being removed?

~~~
9point6
Ah, I actually didn't realise this was the case, I've always used
`.bind(this)` for this kind of thing.

------
vkjv
I'm curious why the `thisArg` parameters were removed? I dug through some of
the PRs and commmits but was unable to find any specific conversation.

It seems odd since the `Array.prototype` methods include it.

[https://github.com/lodash/lodash/commit/454aca7003e14994e7b9...](https://github.com/lodash/lodash/commit/454aca7003e14994e7b9f6ebc5ab436142690eda)

~~~
jdd
It was removed because it added extra complexity for method implementations
and was used very little. Folks now can use `_.bind`, or `Function#bind`, or
arrow functions.

------
insulanian
Whatever happened to underdash
([https://github.com/underdash/underdash](https://github.com/underdash/underdash))?

~~~
laughinghan
The second paragraph mentions/links to underdash: "The year was also one of
collaboration as discussions began on merging Lodash & Underscore."

~~~
insulanian
Exactly, "began" \- I expected next major version to actually be a merge.
Hopefully they can now focus on that...

------
stared
As I see, lodash is a big fan of renaming functions.

(In any case, this library saves me a lot of manual labour, headache + can
write in a functional way without poor performance.)

------
painisRelative
why drop bower support damn it!

~~~
dannynemer
Lodash dropped bower support in favor of npm because "16% use bower vs. 76%
npm for AMD packages":
[https://twitter.com/jdalton/status/677323442488672257](https://twitter.com/jdalton/status/677323442488672257)

~~~
bryanlarsen
Given that there were 14825158 downloads of lodash from npm last month, that
implies that there were over 3M downloads from bower. That's a lot of people
to throw under the bus.

~~~
jdd
According to bower stats over the last 7 days lodash was installed 23 times
compared to 4 million npm downloads & 181 new npm packages depending on it.

[http://bower.io/stats/](http://bower.io/stats/)

[http://npm-stat.com/charts.html?package=lodash](http://npm-
stat.com/charts.html?package=lodash)

[https://gist.github.com/anvaka/8e8fa57c7ee1350e3491/revision...](https://gist.github.com/anvaka/8e8fa57c7ee1350e3491/revisions)

~~~
Macha
Sounds broken. My team alone would have installed it more times that that.

~~~
jdd
¯\\_(ツ)_/¯

~~~
Macha
After thinking about it a bit more, the only reasonable conclusion I can come
to is the following:

It's the number of times users actually typed

    
    
        bower install lodash
    

i.e. adding it to a project that didn't already have it, as opposed to just
running bower install on a package which uses lodash.

Would also explain why despite bower itself being installed 37000 times in the
last 7 days, the most installed package is only listed as 100 or so times.

------
possibleNoob
How does this compare to lazy.js?

------
mkoryak
oh nice, they dropped ie9 support!

oh no, so many breaking changes that I cant use it!

~~~
rev_bird
> so many breaking changes that I cant use it!

Isn't that the point of a major version bump? It's not like being mad at
3.11.0 wrecking everything.

~~~
esailija
Majors, especially majors that are coming often with no lts for older
versions, should make minimal breaking changes.

~~~
9point6
The whole point of major version bumps (in semver) is to allow of these kinds
of breaking changes. When should these changes be made if not during a major
version bump?

~~~
mkoryak
i wasnt trying to complain about breaking changes, i was saying that i am sad
that i have a cod base which cannot use this. I am sure many people are in the
same boat

~~~
jdd
Adoption is doing pretty well. In just over 2 weeks since its release
lodash@^4.0.0 is in the top 50 most depended on npm packages.

