UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

25 lines (23 loc) 552 B
import { dfdlT } from "@monstermann/dfdl"; //#region src/array/findLastIndex.ts /** * `findLastIndex(array, predicate)` * * Returns the index of the last element in `array` that satisfies the provided `predicate` function, or -1 if no element is found. * * ```ts * findLastIndex([1, 2, 3, 4], (x) => x > 2); // 3 * ``` * * ```ts * pipe( * [1, 2, 3, 4], * findLastIndex((x) => x > 2), * ); // 3 * ``` */ const findLastIndex = dfdlT((target, predicate) => { return target.findLastIndex(predicate); }, 2); //#endregion export { findLastIndex };