UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

28 lines (26 loc) 821 B
import { ArrayPredicate } from "./internals/types.js"; //#region src/array/findRemoveLast.d.ts /** * `findRemoveLast(array, predicate)` * * Finds the last element in `array` that satisfies the provided `predicate` function and removes it, returning a new array without the removed element. * * ```ts * findRemoveLast([1, 2, 3, 4], (x) => x > 2); // [1, 2, 3] * ``` * * ```ts * pipe( * [1, 2, 3, 4], * findRemoveLast((x) => x > 2), * ); // [1, 2, 3] * ``` */ declare const findRemoveLast: { <T>(predicate: ArrayPredicate<T>): (target: T[]) => T[]; <T>(predicate: ArrayPredicate<T>): (target: readonly T[]) => readonly T[]; <T>(target: T[], predicate: ArrayPredicate<T>): T[]; <T>(target: readonly T[], predicate: ArrayPredicate<T>): readonly T[]; }; //#endregion export { findRemoveLast };