DEV Community

Discussion on: It's time to let go of lodash

Collapse
 
cheerfulstoic profile image
Brian Underwood

I agree with a bit of this. Sometimes it's simple enough to use forEach or map or reduce directly. And honestly, I wasn't familiar with the spread syntax, and that is 🔥

But there is a bit of a strawman argument here. I don't care about cross-browser compatibility (or browser download size so much at the moment given that I'm doing a lot of Node.js). You've skipped past many of the conveniences of lodash which make it quite worthwhile:

  • The ability to chain multiple functions together nicely
  • You wrote a partition alternative, but, please, that is so ugly. Why should we spend our time writing that and struggle getting it right?
  • When using map or each or filter, there is so much convenience is being able to use the simpler forms like _.map(arr, 'foo.bar.bar') or .filter(arr, {key: value}).
  • It makes working with enumerating over objects simpler than plain JS

Just in general, it's nice to have around to do the simple things (like partition, but much more of course) that I shouldn't be spending my time worrying about. And it provides a consistent interface to it all. Your examples about type inference and checking just make me ❤️ lodash even more because, just look at those JS examples. It's a such mismash! 😃

Thanks for the post!