Skip to content

Commit

Permalink
refactor: Arrange findIndex as a ponyfill 🛠
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchief committed Mar 28, 2020
1 parent 9ff3007 commit a6c63b5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/findIndex.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
function findIndex(arr, predicate, thisArg) {
// if native support is available, ship it off
if (Array.prototype.findIndex) {
return arr.findIndex(predicate, thisArg)
}

if (!arr) {
throw new TypeError('findIndex called on null or undefined')
}
Expand Down

0 comments on commit a6c63b5

Please sign in to comment.