DEV Community

Cover image for Do you still use Lodash and Underscore in 2020?

Do you still use Lodash and Underscore in 2020?

Madza on October 10, 2020

Since 2015, ES6 and the above versions have implemented many of the features of the utility libraries like Lodash and Underscore, questioning the n...
Collapse
 
daviddalbusco profile image
David Dal Busco

Your question makes me think, DEV should add a Poll feature to Forem 😉.

To answer your question: directly no. I think the last time I used one of these was 2 years ago at least.

But, indirectly yes and pretty sure it is the case for most us. These libraries are still use by some third party libraries and therefore added to node_modules.

Collapse
 
defman profile image
Sergey Kislyakov

Poll feature

There is, actually. It's available only to admins, though.

Collapse
 
daviddalbusco profile image
David Dal Busco • Edited

Ah cool! Maybe some it will be accessible to all, would be nice 🤞

Collapse
 
blackr1234 profile image
blackr1234 • Edited

I still use Lodash in my personal React project, such as union, filter, find, map and findIndex. I think OP can list some examples showing how one can replace Lodash operations with vanilla ES6, so everyone (incl. JS newbies) can see the similarities and differences.

Some figures show that Lodash performs way better than vanilla JS (correct me if I'm wrong). Also, some think that Lodash utility functions are more readable, so it's not just about functionality. Personally, I think when I use Lodash I write less code.

Collapse
 
yoursunny profile image
Junxiao Shi

I have _.debounce in a project written in 2018. ES2018 doesn't have an equivalent.

Collapse
 
puruvj profile image
PuruVJ • Edited

npmjs.com/package/throttle-debounce Works like a charm

Only a few bytes

Collapse
 
futureistaken profile image
R Z

Did you see how it works under the hood? I think, the functionality is redundant for the most use cases.

Collapse
 
viacheslavzyrianov profile image
Zyrianov Viacheslav

What about objects deep cloning?

Collapse
 
cullophid profile image
Andreas Møller

I has been year since I needed to deeply clone an object. Is this a common use case for you?

Collapse
 
viacheslavzyrianov profile image
Zyrianov Viacheslav

It's not about frequency of using, but having a possibility to use it.

Collapse
 
okslutsiv profile image
Oksana

in case of multi-level objects with no methods JSON.parse(JSON.stringify(obj)) does the perfect job.

Collapse
 
cullophid profile image
Andreas Møller

I use keyBy, groupBy, mapKeys and mapValues quite regularly.

Collapse
 
evert profile image
Evert Pot

I'm only aware of using lodash when it has yet another security vulnerability, and it's always an indirect dependency.

Most things lodash does can be done in line with a few lines of code, and those lines of code convey intent better than a cryptic lodash function name.

Collapse
 
angelsantosa profile image
Angel Santos

I work in a project that has a lot of functionality with lodash, I believe in the react method of getting rid of class components, just don't use it in new functionality.

Same I do with lodash, it's like "The jquery" of this generation.

Collapse
 
johnkazer profile image
John Kazer

Never really tried, I use Ramda instead.

Collapse
 
angelsantosa profile image
Angel Santos

Rambda makes code uncomfortable.

Collapse
 
johnkazer profile image
John Kazer

In what way? I realise Ramda has a different attitude to parameters from lodash (e.g. data last) but for me that's an improvement and enables more options for code organisation should you want to use them.

Collapse
 
albertomontalesi profile image
AlbertoM

On my own projects no but in the codebase at work we have a couple of instances where we use lodash, one example being cloneDeep

Collapse
 
saisandeepvaddi profile image
Sai Sandeep Vaddi

I do. I mostly use throttle, debounce.

Occassionally I use union, difference, set and get (for nested objects), groupBy

Collapse
 
hussainarthuna profile image
Hussain Arthuna

Yes I do use Underscore JS in most of my projects. Really helpful ❤️

Collapse
 
neilcodes profile image
Neil

I occasionally use the individually packaged lodash functions. Having a known good deepClone function is oftentimes very handy.

Collapse
 
theonlybeardedbeast profile image
TheOnlyBeardedBeast

Only for debounce and throttle

Collapse
 
bassochette profile image
Julien Prugne

Yes, in large team with a big turnover and a lot of juniors you can reduce wheel reinventing by 100% on basic function.
Squared and triangle wheels are less than optimal.

Collapse
 
angelmtztrc profile image
Angel Martinez

The last time I used underscore was two years or more ago, when nodejs still didn't support object destructuring and some other things like that

Collapse
 
avneeshroks profile image
avneeshroks

I use lodash.. it's not that heavy so I don't mind..

Collapse
 
alekseiberezkin profile image
Aleksei Berezkin

Both are ES6-iterables incompatible, so no.

Collapse
 
jwp profile image
John Peters

Not now but did 2 years ago.