Skip to content

Commit

Permalink
fix(util): incorrect Symbol.iterator for es6-shim
Browse files Browse the repository at this point in the history
  • Loading branch information
marclaval authored and benlesh committed Nov 10, 2015
1 parent 9f0ecf7 commit 15bf32c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/util/Symbol_iterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ if (!root.Symbol.iterator) {
} else if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
// Bug for mozilla version
root.Symbol.iterator = '@@iterator';
} else if (root.Map) {
// es6-shim specific logic
let keys = Object.getOwnPropertyNames(root.Map.prototype);
for (let i = 0; i < keys.length; ++i) {
let key = keys[i];
if (key !== 'entries' && key !== 'size' && root.Map.prototype[key] === root.Map.prototype['entries']) {
root.Symbol.iterator = key;
break;
}
}
} else {
root.Symbol.iterator = '_es6shim_iterator_';
root.Symbol.iterator = '@@iterator';
}
}

Expand Down

0 comments on commit 15bf32c

Please sign in to comment.