4 ms·
Object.keys() is rather well supported these days though.
by DrJokepu 10y ago
Object.keys() is rather well supported these days though.
- frostik 10y agoYes, but means that you need to implement map, foreach, filter yourself. So you might be better off with lodash.
- deleted 10y ago[deleted]
- mullsork 10y agoI think he's referring to `Object.keys(object).reduce`. We polyfill `Object.entries` so we do `Object.entries(object).reduce((result, [key, value]) => ...)`
- crucialfelix 10y agoRelated: 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/ 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.
- jacobr 10y agoAnd Object.values is supported in Chrome and Firefox, and has polyfills for other browsers.