//#region src/Array/lastOrElse.d.ts /** * # lastOrElse * * ```ts * function Array.lastOrElse( * target: readonly T[], * orElse: (target: readonly NoInfer[]) => U, * ): Exclude | U * ``` * * Returns the last element of `array`, or the result of calling `callback` with the array if the array is empty. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.lastOrElse([1, 2, 3, 4], (arr) => arr.length); // 4 * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, 2, 3, 4], * Array.lastOrElse((arr) => arr.length), * ); // 4 * ``` * */ declare const lastOrElse: { (orElse: (target: readonly NoInfer[]) => U): (target: readonly T[]) => Exclude | U; (target: readonly T[], orElse: (target: readonly NoInfer[]) => U): Exclude | U; }; //#endregion export { lastOrElse };