Skip to content

Commit

Permalink
Fix Map polyfill not creating when cacheKey of -1 was previously cach…
Browse files Browse the repository at this point in the history
…ed. Fixes rbuckton#56
  • Loading branch information
Jason Bedard committed Feb 11, 2017
1 parent 22d7ec8 commit 50abaa2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Reflect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1566,8 +1566,11 @@ namespace Reflect {
"@@iterator"() { return this.entries(); }
[iteratorSymbol]() { return this.entries(); }
private _find(key: K, insert?: boolean): number {
if (this._cacheKey === key) return this._cacheIndex;
let index = this._keys.indexOf(key);
let index;
if (this._cacheKey === key)
index = this._cacheIndex;
else
index = this._keys.indexOf(key);
if (index < 0 && insert) {
index = this._keys.length;
this._keys.push(key);
Expand Down

0 comments on commit 50abaa2

Please sign in to comment.