feat: pass key to iterator
This commit is contained in:
parent
0d96cb6ad5
commit
95f0dd8189
|
@ -3,7 +3,7 @@ export function map(O, fn) {
|
||||||
const result = {};
|
const result = {};
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
const key = keys[i];
|
const key = keys[i];
|
||||||
result[key] = fn(O[key]);
|
result[key] = fn(O[key], key);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user