| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 1 7 7 7 22 6 16 1 | function findIndex(xs, iteratee, thisArg) {
let fn = thisArg ? iteratee.bind(thisArg) : iteratee;
let i = 0;
for (let x of xs) {
if (fn(x, i, xs)) {
return i;
}
i += 1;
}
return -1;
}
export default findIndex;
|