Is Lodash still needed with ES6+?

Asked

Viewed 44 times

-1

I see that in 2020 lodash is no longer needed, we managed to do 90% of what it does with ES6+ and fast, so I get the cruel doubt, is it really necessary to install a giant dependency like this in the projects? I know that when we are talking about Angular we can use RXJS, but I refer to Javascript in general

2 answers

3


Lodash, like jQuery, Mootools or Rxjs are toolboxes. While using ES6 much of the functionality that Lodash offers needs many lines of code to implement and Lodash ensures tested tools in production scenario, this is very important.

Your fear of importing a giant dependency is not correct. Lodash allows you to import only the tools you need using the syntax:

import clamp from 'lodash/clamp';
import toInteger from 'lodash/toInteger';

I use it a lot debounce for example, if you were to write this function alone you would have to test it and it would not be short in the first iterations.

Having said that it is clear that it is important to always reduce the number of external dependencies. If you don’t need Lodash, or what you need is easy and safe to do with homemade tools then go in that direction.

  • "Homemade tools" here in Brazil sometimes have a slightly negative connotation, depending on the region, suggesting that maybe it is "precarious", I do not know if it is the intention. Maybe "own tools" are more neutral (but it even goes from intention - no problem in your sentence, just wanted to mention - after I delete the comment)

  • @Bacco good, I didn’t know this difference. Own tools in the sense of not public is what I meant.

0

But Lodash’s purpose is different. ES6 is roughly a specification of Javascript, a set of rules that will regulate language implementations. The purpose of Lodash is to facilitate Javascript, helping to work with matrices, numbers, objects, character sequences and other things.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.