Hacker News new | ask | show | jobs
by DrJokepu 3639 days ago
Object.keys() is rather well supported these days though.
3 comments

Yes, but means that you need to implement map, foreach, filter yourself. So you might be better off with lodash.
I think he's referring to `Object.keys(object).reduce`. We polyfill `Object.entries` so we do `Object.entries(object).reduce((result, [key, value]) => ...)`
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.

And Object.values is supported in Chrome and Firefox, and has polyfills for other browsers.