Underscore vs Lodash vs Sugar?


I know Underscore and Lodash, but I miss Sugar.
What do you think: Underscore vs Lodash vs Sugar?


You need to put link to those so people can go have a look in case they don’t know all three. Also, it depends, what use case do you have in mind you compare them against?


I used to like Sugar too… in fact I almost released a library called “Dunderscore” which implemented all underscore methods as [1,2,3].__contains(2);.

However after I started learning about functional programming and saw how it made my codebase simpler, I really appreciate having separate functions.

You can clean them up a bit by doing this:

import {map} from 'underscore';
// or
var map = _.map;

users = [{name: 'Bob', age: 21, name: 'Leah', age: 32}];

names = map(users, (user) => user.name);

I also prefer Ramda over underscore because it doesn’t mutate and allows for currying: http://ramdajs.com


Interestingly we went through this adventure when building Discourse and ended up picking lodash.



Please add link for Dunderscore.


It’s gone… I burnt it up before anyone could see it :smile: . It had the same prototype issues that Sugar had (see Sam’s post)

I would pick lo-dash over underscore but if you’re using Blaze I would use underscore since it’s included with Blaze. Lo-dash has a slightly better API in my opinion.