UNPKG

353 BJavaScriptView Raw
1import { bindCallback } from '../internal/bindcallback';
2export async function findIndex(source, predicate, thisArg) {
3 const fn = bindCallback(predicate, thisArg, 2);
4 let i = 0;
5 for await (let item of source) {
6 if (await fn(item, i++)) {
7 return i;
8 }
9 }
10 return -1;
11}
12
13//# sourceMappingURL=findindex.mjs.map