News for hackers. Stuff that matters.
Re:Lists of JavaScript methods which you can use natively by DrJokepu on Friday July 01, 2016 @07:04AM (#12015092)
Object.keys() is rather well supported these days though.
Re:Lists of JavaScript methods which you can use natively by frostik on Friday July 01, 2016 @07:18AM (#12015153)
Yes, but means that you need to implement map, foreach, filter yourself. So you might be better off with lodash.
Re:Lists of JavaScript methods which you can use natively by mullsork on Friday July 01, 2016 @07:41AM (#12015244)
I think he's referring to `Object.keys(object).reduce`. We polyfill `Object.entries` so we do `Object.entries(object).reduce((result, [key, value]) => ...)`
Re:Lists of JavaScript methods which you can use natively by crucialfelix on Friday July 01, 2016 @07:39AM (#12015237)
Related:

for (var key of Object.keys(imps)) { }

I figured that would work with babel-2015 and it did work on Chrome and Safari but on Firefox visitors were getting:

Symbol.Iterator undefined

You need http://babeljs.io/docs/plugins/transform-es2015-for-of/ as well.

So there is much less risk in using _.each(imps, (value, key) => and not having to discover what you don't know.

I also added Firefox to the unit tests after that.

Re:Lists of JavaScript methods which you can use natively by jacobr on Friday July 01, 2016 @08:50AM (#12015560)
And Object.values is supported in Chrome and Firefox, and has polyfills for other browsers.