Skip to content

Commit a6c63b5

Browse files
committed
refactor: Arrange findIndex as a ponyfill 🛠
1 parent 9ff3007 commit a6c63b5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/utils/findIndex.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
function findIndex(arr, predicate, thisArg) {
2+
// if native support is available, ship it off
3+
if (Array.prototype.findIndex) {
4+
return arr.findIndex(predicate, thisArg)
5+
}
6+
27
if (!arr) {
38
throw new TypeError('findIndex called on null or undefined')
49
}

0 commit comments

Comments
 (0)