UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

17 lines (15 loc) 411 B
import { bindCallback } from '../util/bindcallback'; export function findIndex(source, predicate, thisArg) { if (typeof predicate !== 'function') { throw new TypeError(); } const f = bindCallback(predicate, thisArg, 2); let i = 0; for (const item of source) { if (f(item, i++)) { return i; } } return -1; } //# sourceMappingURL=findindex.mjs.map