//#region src/Array/atOrElse.d.ts /** * # atOrElse * * ```ts * function Array.atOrElse( * target: readonly T[], * offset: number, * orElse: (target: readonly NoInfer[]) => U, * ): Exclude | U * ``` * * Returns the value at the specified `offset`. Calls `fallback` if the `offset` was out of range, or the retrieved value was nullable. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.atOrElse([1, null], -1, (array) => array.length); // 2 * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, null], * Array.atOrElse(-1, (array) => array.length), * ); // 2 * ``` * */ declare const atOrElse: { (offset: number, orElse: (target: readonly NoInfer[]) => U): (target: readonly T[]) => Exclude | U; (target: readonly T[], offset: number, orElse: (target: readonly NoInfer[]) => U): Exclude | U; }; //#endregion export { atOrElse };