Amy Blankenship
1 min readMar 17, 2020

--

The biggest advantage of using lodash is to read through the function definitions and understand how they help your programming and how you can do the same kinds of things yourself, if you so choose.

But I think you missed a whole lot of good functions that people can use right now. For example, imagine you’re adding code to debug an issue with a promise. You don’t want to write a whole lot of code, just to have to remove it later. So, you could go to this:
fnThatReturnsApromise.then((value) => {//do something}, _.wrap(‘my debug message’, console.log))

And for testing, the “stub” functions are invaluable. _.identity is great for mocking localization functions. And, speaking of localization, if the template itself is coming from a localization resource as a string, there’s still a place for _.template.

Need to batch calls so you don’t overwhelm the browser? Try _.chunk. Need to just run an array of functions (like on component destroy in AngularJS)? Look at _.over.

I could go on and on, but this is all in the docs. Unfortunately, it looks like most people don’t spend much time with them before expressing an opinion.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

Responses (1)