DEV Community

Discussion on: 5 Must Know Lodash Methods

Collapse
 
fxbit profile image
Petros Vasileiou

In general for this simple cases yes you don't need lodash, but in more real complex applications is simplify many things especially the chaining.

For example in 1 and 4 when you don't know in compile time the "path", but is something that is user/api/external input how you are going to do it ?

One other thing that I like in lodash is the internal error checking and handling. For example the 2 and 3 example if the adoptableDogs is null/undefined the code is going to get exception, you need to check it before use it.
The lodash is going to return empty array in map and null in find, a consistent result that you don't need to have special check or path in your code flow.

Thread Thread
 
jonrandy profile image
Jon Randy 🎖️

I agree. I was merely pointing out that these were poor examples, that do not really give any idea of why, and in what situations Lodash can be beneficial