BT

Underscore and Lodash Discuss Merging

| by David Iffland Follow 4 Followers on May 26, 2015. Estimated reading time: 2 minutes |

Underscore and Lodash, popular JavaScript libraries long seen as rivals, have started discussions on merging. The idea sounds promising and a boon for developers, but with strong personalities heading up each project, complete agreement seems impossible.

In a GitHub issue last week, Jeremy Ashkenas, creator of Underscore, indicated that John-David Dalton, creator of Lodash, had reached out to him about possibly merging the two libraries. What ensured was a frenzied discussion from the community. Proponents of each side weighed in on their reasons why one or the other should become the main.

For some, lodash is seen as the only option and that underscore is a toy for the less serious. "Why not just deprecate underscore? Lodash is obviously the more mature and maintained of the two," says Nijiko Yonskai. He continued:

It makes no sense to merge these two projects, unless by merge you mean to drop underscore and work on lodash. They both serve different purposes, Lodash is for those who want a more comprehensive, solid, and well maintained library.

One standout feature of lodash is its modularity: rather than having to include the entire library, developers can include just the functions they need. Each module is exposed in npm, so developers can reference them indivudally:

npm install lodash.map

var map = require('lodash.map');

The projects each approached documentation from a different angle. Underscore has a conversational tone while lodash's approach tends towards a more formal style. For example, here is how the documentation differs for the each function:

Underscore

Iterates over a list of elements, yielding each in turn to an iteratee function. The iteratee is bound to the context object, if one is passed. Each invocation of iteratee is called with three arguments: (element, index, list). If list is a JavaScript object, iteratee's arguments will be (value, key, list). Returns the list for chaining.

Lodash

Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg and invoked with three arguments: (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false.

In an interview with InfoQ, Dalton said he reached out to Ashkenas because of the shared vision of the libraries:

We share much of the same goals, much of the same API (~60%), and much of the same contributors. Merging makes sense as it would reduce a lot of duplicated effort on both sides and simplify choices & support for developers.

But the "how" of the merge is unclear. On a separate GitHub discussion among Underscore contributors, Ashkenas says:

Why bother building and publishing an interim FrankenScore that increases complexity in the short term? I don't see the point. I think it's more worth trying to imagine a unified "Underscore 2.0" that everyone can agree on, and working towards that goal.

Asked by InfoQ about the merge, James Kyle, contributor to Babel says the status quo will continue. "Things will continue on as they have been. Lodash will slowly but surely take over". He sounds a hopeful note, however:

There is too much duplication of effort today in the JavaScript community, and the primary reason for it is people not being able to come to a reasonable agreement when their opinions differ. Lodash seems fairly flexible on making changes to accommodate Underscore. However, if Underscore won't budge on certain things I personally would rather they don't merge.

Underscore.js and Lodash are some of the most used JavaScript libraries. Combined, they were downloaded almost 2 million times in the past month on npm.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Fewer frameworks by Scott Jones

Please merge the two or deprecate Underscore. We don't need so many frameworks.

Thanks,
Developers everywhere

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT