//#region src/Array/findReplaceLastOr.d.ts /** * # findReplaceLastOr * * ```ts * function Array.findReplaceLastOr( * target: readonly T[], * predicate: ( * value: NoInfer, * index: number, * target: readonly NoInfer[], * ) => boolean, * replacement: NoInfer, * or: U, * ): readonly T[] | U * ``` * * Finds the last element in `array` that satisfies the provided `predicate` function and replaces it with `replacement`, returning a new array with the replaced element, or `fallback` if no element is found. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.findReplaceLastOr([1, 2, 3, 4], (x) => x > 10, 99, []); // [] * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, 2, 3, 4], * Array.findReplaceLastOr((x) => x > 10, 99, []), * ); // [] * ``` * */ declare const findReplaceLastOr: { (predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => boolean, replacement: NoInfer, or: U): (target: T[]) => T[] | U; (predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => boolean, replacement: NoInfer, or: U): (target: readonly T[]) => readonly T[] | U; (target: T[], predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => boolean, replacement: NoInfer, or: U): T[] | U; (target: readonly T[], predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => boolean, replacement: NoInfer, or: U): readonly T[] | U; }; //#endregion export { findReplaceLastOr };