//#region src/Array/setAtOr.d.ts /** * # setAtOr * * ```ts * function Array.setAtOr( * target: readonly T[], * idx: number, * value: NoInfer, * or: U, * ): readonly T[] | U * ``` * * Sets the value at the specified `idx` in `target` to `value`. If the index is out of bounds, returns `or`. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.setAtOr([1, 2, 3], 1, 9, []); // [1, 9, 3] * Array.setAtOr([1, 2, 3], -1, 9, []); // [1, 2, 9] * Array.setAtOr([1, 2, 3], 5, 9, []); // [] * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe([1, 2, 3], Array.setAtOr(1, 9, [])); // [1, 9, 3] * pipe([1, 2, 3], Array.setAtOr(-1, 9, [])); // [1, 2, 9] * pipe([1, 2, 3], Array.setAtOr(5, 9, [])); // [] * ``` * */ declare const setAtOr: { (idx: number, value: NoInfer, or: U): (target: T[]) => T[] | U; (idx: number, value: NoInfer, or: U): (target: readonly T[]) => readonly T[] | U; (target: T[], idx: number, value: NoInfer, or: U): T[] | U; (target: readonly T[], idx: number, value: NoInfer, or: U): readonly T[] | U; }; //#endregion export { setAtOr };