re: Using Underscore/Lodash: Yea or Nay? VIEW POST


Here's my take. It's certainly true that many of the functions that made underscore and lodash so popular have been added to the language proper, and it's generally better for performance to use the native version of a function, which the browser can usually optimize more heavily, than to use a JS implementation of the same thing. And it's also certainly true that a smaller JS bundle size is faster to download, so fewer libraries can help there.

But with that said, lodash in particular is one of the most performant libraries out there. John-David Dalton, its creator and maintainer, is known for being a performance fiend. Heck, he's also the guy who created, everyone's favorite "run this code a billion times" app.

And as far as bundle size goes, lodash (and many other libraries) have moved in recent years to a very modularized format, which makes it very easy for build tools like webpack and parcel to do tree-shaking, removing at build-time any functions that are never used, which really helps reduce your bundle size.

If you do go with lodash (which I personally use all the time), I highly recommend looking into the lodash/fp module, which is amazing. It helps eliminate some of the biggest frustrations I've had with lodash in the past, and allows for much more streamlined code.

code of conduct - report abuse