Skip to content

Commit

Permalink
Chrome 40 defines the incorrect name for Array#values
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 24, 2015
1 parent 87e880c commit bfed50c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,12 @@
Array.prototype[Symbol.unscopables].values = true;
}
}
// Chrome 40 defines Array#values with the incorrect name, although Array#{keys,entries} have the correct name
if (Array.prototype.values && Array.prototype.values.name !== 'values') {
var originalArrayPrototypeValues = Array.prototype.values;
defineProperty(Array.prototype, 'values', function values() { return originalArrayPrototypeValues.call(this); }, true);
Array.prototype[$iterator$] = Array.prototype.values;
}
defineProperties(Array.prototype, ArrayPrototypeShims);

addIterator(Array.prototype, function () { return this.values(); });
Expand Down

0 comments on commit bfed50c

Please sign in to comment.