//#region src/Array/findReplaceLastOrElse.d.ts /** * # findReplaceLastOrElse * * ```ts * function Array.findReplaceLastOrElse( * target: readonly T[], * predicate: ( * value: NoInfer, * index: number, * target: readonly NoInfer[], * ) => boolean, * replacement: NoInfer, * orElse: (target: readonly NoInfer[]) => 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 the result of calling `callback` with the array if no element is found. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.findReplaceLastOrElse( * [1, 2, 3, 4], * (x) => x > 10, * 99, * (arr) => arr.length, * ); // 4 * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, 2, 3, 4], * Array.findReplaceLastOrElse( * (x) => x > 10, * 99, * (arr) => arr.length, * ), * ); // 4 * ``` * */ declare const findReplaceLastOrElse: { (predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => boolean, replacement: NoInfer, orElse: (target: readonly NoInfer[]) => U): (target: T[]) => T[] | U; (predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => boolean, replacement: NoInfer, orElse: (target: readonly NoInfer[]) => U): (target: readonly T[]) => readonly T[] | U; (target: T[], predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => boolean, replacement: NoInfer, orElse: (target: readonly NoInfer[]) => U): T[] | U; (target: readonly T[], predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => boolean, replacement: NoInfer, orElse: (target: readonly NoInfer[]) => U): readonly T[] | U; }; //#endregion export { findReplaceLastOrElse };