//#region src/Array/mapAtOr.d.ts /** * # mapAtOr * * ```ts * function Array.mapAtOr( * target: readonly T[], * idx: number, * map: ( * value: NoInfer, * index: number, * target: readonly NoInfer[], * ) => T, * or: 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 `fallback` if the index is out of bounds. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.mapAtOr([1, 2, 3], 10, (x) => x * 10, []); // [] * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, 2, 3], * Array.mapAtOr(10, (x) => x * 10, []), * ); // [] * ``` * */ declare const mapAtOr: { (idx: number, map: (value: NoInfer, index: number, target: readonly NoInfer[]) => T, or: U): (target: T[]) => T[] | U; (idx: number, map: (value: NoInfer, index: number, target: readonly NoInfer[]) => T, or: U): (target: readonly T[]) => readonly T[] | U; (target: T[], idx: number, map: (value: NoInfer, index: number, target: readonly NoInfer[]) => T, or: U): T[] | U; (target: readonly T[], idx: number, map: (value: NoInfer, index: number, target: readonly NoInfer[]) => T, or: U): readonly T[] | U; }; //#endregion export { mapAtOr };