Well, using it changed my mind very quickly.
What is Lodash for?
Lodash offers several functions to help you write clear and simple code. Especially when it comes to arrays or collection handling. A simple example to exclude specific elements from an array:
Many functions like this one are easy to understand while others like ‘transform’ are harder to master.
How can I use Lodash?
The answer is simple. You only need to include the single lodash.js file. You can either download it directly from the website or include the “Lodash” package using bower or NPM.
The best way to show you how many lines of code you can save while using Lodash is by using an example. So here we go!
This creates a new array only containing elements with values of the first array unequal to the ones given as second parameter. Notice how we only need one line when using Lodash.
_.intersection(array1, array2, …)
This creates a new array only containing elements which are included in every given array, an intersection.
Wait, what? Yeah, you got that one right – kebab case. The function name is written in camel case, crazy, isn’t it? Well, all it does is to change a string to kebab case, which is, in case you didn’t know, the one which separates words by ‘–’, e.g. from “kebabCase” to “kebab-case”.
Lodash offers more case-modifying functions such as camel case.
Compared to other libraries like underscore.js, Lodash is updated more frequently while underscore.js has some inconsistent support for arrays, strings, objects, and argument objects in newer browsers. What is more, Lodash has some more functionality, Performance Gains and 100% code coverage.