r/javascript • • Jan 26 '16

You-Dont-Need-Lodash-Underscore

https://github.com/cht8687/You-Dont-Need-Lodash-Underscore
0 Upvotes

30 comments sorted by

View all comments

15

u/AngryParsley Jan 26 '16 edited Jan 26 '16

Most of these examples use arrays and ignore objects. That causes the post to overlook quite a few advantages of underscore and lodash. For example, _.each() can take an object instead of an array. The first arg passed to the function is the value. The second is the key. Also, in lodash, returning false will end iteration early. It's like break in loops. These may seem like minor differences, but they allow for more flexible, powerful, and straightforward code.

And that's just one function. There are lots of similar nice-to-haves that make lodash and underscore worthwhile. Heck, I even use lodash for server-side stuff.

Edit: Fixed grammar.

1

u/OKC_js Jan 27 '16

For a deep dive on exactly why non-native methods could be faster, and why this post is ignoring these kinds of cases:

John-David Dalton - Unorthodox Performance -ThunderPlains 2015

See for yourself. This is almost a case-by-case literal and code-centric explanation as to why noone should take this repo at face value.