Fix object coercion.

This commit is contained in:
John-David Dalton
2017-04-16 15:30:42 -05:00
parent e2941dda3b
commit aa5e1b2fe0
7 changed files with 20 additions and 10 deletions

View File

@@ -18,8 +18,10 @@
* // => { 'a1': 1, 'b2': 2 }
*/
function mapKey(object, iteratee) {
object = Object(object)
const result = {}
Object.keys(Object(object)).forEach((key) => {
Object.keys(object).forEach((key) => {
const value = object[key]
result[iteratee(value, key, object)] = value
})