r/Frontend • • Jan 26 '16

You-Dont-Need-Lodash-Underscore

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

17 comments sorted by

9

u/NervosaX Jan 26 '16

Lots of browsers not supporting those native versions. Guess I -do- need lodash/underscore

-1

u/cht8687 Jan 26 '16

:) Just in case you are targeting newest browsers.

4

u/w4efgrgrgergre Jan 26 '16

Native implementations are not always faster. You should probably remove that section.

0

u/cht8687 Jan 26 '16

removed...

3

u/[deleted] Jan 26 '16

[removed] — view removed comment

1

u/NervosaX Jan 26 '16

Fair comment.

6

u/rajittheqeek Jan 26 '16

Each lodash/underscore function handles nulls without an exception whereas you'll get "Uncaught TypeError: Cannot read property 'xxxxx' of null" with the native one.

I'd probably lean on the side of using native functions, but you should be aware of the differences.

1

u/[deleted] Jan 26 '16

Article at link needs mobile browser support listed to be universally useful / equivalent to lodash / underscore. Also should be called "you may not need lodash underscore". There's a stack of functionality in those libraries.

Edit: useful article though.

1

u/cht8687 Jan 26 '16

oh, thank you for the suggestion.

1

u/DOG-ZILLA Jan 26 '16

There are some mistakes in this.

Under heading _.some() - it still uses _.every() for the lodash example. (Not sure if that's deliberate).

Similar thing with _.contains() too, but now that looks corrected.

1

u/cht8687 Jan 27 '16

yes, corrected!

3

u/PUSH_AX Head of engineering Jan 26 '16

This is good, but the title is bad IMO, I think anyone who is a frontend dev for a business is going to need the browser support and performance. And I think that encapsulates most devs.

4

u/TheNiXXeD Jan 26 '16

A big benefit of lodash is null safety, which native methods are not. Also, pluck syntax for methods like map and find. Also, lazy evaluation. Also much more.

Actually, I do need lodash.

1

u/dscer Jan 26 '16

This, this and this. Not to mention that it provides consistent performance on different browsers and most of the functions can be used on objects as well.