Skip to content

Commit

Permalink
fix(allSettled): stop using for-of
Browse files Browse the repository at this point in the history
  • Loading branch information
suguru03 committed Jun 30, 2019
1 parent cd021f9 commit e27fed0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/allSettled.js
Expand Up @@ -23,13 +23,11 @@ function createResolve(proxy) {
if (Array.isArray(result)) {
result = result.map(iterator);
} else if (result instanceof Map) {
for (const [key, val] of result) {
result.set(key, iterator(val, key));
}
const map = result;
result = map;
map.forEach((val, key) => result.set(key, iterator(val, key)));
} else {
for (const [key, val] of Object.entries(result)) {
result[key] = iterator(val, key);
}
Object.entries(result).forEach(([key, val]) => (result[key] = iterator(val, key)));
}
_resolve.call(_promise, result);
};
Expand Down

0 comments on commit e27fed0

Please sign in to comment.