@arrows/array
Version:
Functional tools for JS arrays
19 lines (18 loc) • 601 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.findIndex = void 0;
const curry_1 = require("@arrows/composition/curry");
const _findIndex = (testFn, arr) => arr.findIndex(testFn);
/**
* Functional wrapper for Array.prototype.findIndex
*
* Retrieves the index of the first element in the array
* where predicate is true, and -1 otherwise.
*
* @param testFn Test function
* @param arr Initial array
* @returns Index of the matching element or -1
*/
const findIndex = curry_1.default(_findIndex);
exports.findIndex = findIndex;
exports.default = findIndex;
;