Skip to content

Commit

Permalink
[Fix] avoid needlessly shimming Array#{find, findIndex}
Browse files Browse the repository at this point in the history
Fixes #433.
  • Loading branch information
ljharb committed Jan 23, 2017
1 parent b0b0119 commit 449b794
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -1462,10 +1462,10 @@
// methods of Number, so this test has to happen down here.)
/*jshint elision: true */
/* eslint-disable no-sparse-arrays */
if (![, 1].find(function (item, idx) { return idx === 0; })) {
if ([, 1].find(function () { return true; }) === 1) {
overrideNative(Array.prototype, 'find', ArrayPrototypeShims.find);
}
if ([, 1].findIndex(function (item, idx) { return idx === 0; }) !== 0) {
if ([, 1].findIndex(function () { return true; }) !== 0) {
overrideNative(Array.prototype, 'findIndex', ArrayPrototypeShims.findIndex);
}
/* eslint-enable no-sparse-arrays */
Expand Down

0 comments on commit 449b794

Please sign in to comment.