You Might Not Need Underscore
reindex.io
reindex.io
var a1b2 = _.reduceRight({a:1,b:2},(memo,val,key) => key+val+memo,'');
or: var two = _.find({a:2,b:3,c:4},(val,key) => key !== 'a' && key !== 'c' )
Until I see _.chain, _.compose, _.partialRight, _.zip or _.throttle (among others) implemented in the standard library lodash is a no-opt.With iterables and the "for of" loop javascript is definitely not going in the direction of functional programming though.
Also, there is the simple fact a lot of people like the abstraction compared to the native solution - it is often simpler to use and remember.
> it is often simpler to use and remember Maybe people are used to one library's api, and expect the native counterpart to be more difficult, but the examples given in the article are counter examples to this statement.
Of course there are good reasons for using those libraries, it's all about tradeoffs.
But then you still have. To deal with awesome functional helpers like denounce, not to mention insanely useful things like cloneDeep and zipObject. Instead I'd note to use the natives tuff wherever possible and use lodash to pull in just the functions you need piecemeal.
Oh and you should certainly mention Function.prototype.reduce and Object.assign
And all the other elements...
Yes, you are right. But... The "array" is not always an Array. document.getElementsByClassName( 'myClass' ) is not an Array but a DOMNodeList. So document.getElementsByClassName( 'myClass' ).forEach(iteratee) will not work. Same for map, reduce...
Underscore (or lodash) makes more that just polyfilling es5 methods.
Just thought of 1-level flattening [].concat(...array). But it not that explicit. Also, array.find(i => i.foo == 'bar') isn't as readable as _.find(array, { foo: 'bar' }).
http://www.ecma-international.org/ecma-262/6.0/#sec-array.fr...
Out of curiosity, how would you do it yourself?
thx for the info though. :)