//#region src/Array/mapAtOrElse.d.ts /** * # mapAtOrElse * * ```ts * function Array.mapAtOrElse( * target: readonly T[], * idx: number, * map: ( * value: NoInfer, * index: number, * target: readonly NoInfer[], * ) => T, * orElse: (target: readonly NoInfer[]) => U, * ): readonly T[] | U * ``` * * Applies the `mapper` function to the element at the specified `index` in `array`, returning a new array with the mapped element, or the result of calling `callback` with the array if the index is out of bounds. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.mapAtOrElse( * [1, 2, 3], * 10, * (x) => x * 10, * (arr) => arr.length, * ); // 3 * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, 2, 3], * Array.mapAtOrElse( * 10, * (x) => x * 10, * (arr) => arr.length, * ), * ); // 3 * ``` * */ declare const mapAtOrElse: { (idx: number, map: (value: NoInfer, index: number, target: readonly NoInfer[]) => T, orElse: (target: readonly NoInfer[]) => U): (target: T[]) => T[] | U; (idx: number, map: (value: NoInfer, index: number, target: readonly NoInfer[]) => T, orElse: (target: readonly NoInfer[]) => U): (target: readonly T[]) => readonly T[] | U; (target: T[], idx: number, map: (value: NoInfer, index: number, target: readonly NoInfer[]) => T, orElse: (target: readonly NoInfer[]) => U): T[] | U; (target: readonly T[], idx: number, map: (value: NoInfer, index: number, target: readonly NoInfer[]) => T, orElse: (target: readonly NoInfer[]) => U): readonly T[] | U; }; //#endregion export { mapAtOrElse };