UNPKG

@arrows/array

Version:
19 lines (18 loc) 568 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.find = void 0; const curry_1 = require("@arrows/composition/curry"); const _find = (testFn, arr) => arr.find(testFn); /** * Functional wrapper for Array.prototype.find * * Retrieves the value of the first element in the array * where predicate is true, and undefined otherwise. * * @param testFn Test function * @param arr Initial array * @returns Item that matches predicate or undefined */ const find = curry_1.default(_find); exports.find = find; exports.default = find;