//#region src/Array/insertAllAtOrElse.d.ts /** * # insertAllAtOrElse * * ```ts * function Array.insertAllAtOrElse( * target: readonly T[], * idx: number, * values: Iterable>, * orElse: (target: readonly NoInfer[]) => U, * ): readonly T[] | U * ``` * * Inserts all `values` at the specified `idx` in `target`. If the index is out of bounds, calls `orElse` with the original array. Supports iterables. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.insertAllAtOrElse([1, 2, 3], 1, [8, 9], () => []); // [1, 8, 9, 2, 3] * Array.insertAllAtOrElse([1, 2, 3], 5, [8, 9], (arr) => arr); // [1, 2, 3] * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, 2, 3], * Array.insertAllAtOrElse(1, [8, 9], () => []), * ); // [1, 8, 9, 2, 3] * * pipe( * [1, 2, 3], * Array.insertAllAtOrElse(5, [8, 9], (arr) => arr), * ); // [1, 2, 3] * ``` * */ declare const insertAllAtOrElse: { (idx: number, values: Iterable>, orElse: (target: readonly NoInfer[]) => U): (target: T[]) => T[] | U; (idx: number, values: Iterable>, orElse: (target: readonly NoInfer[]) => U): (target: readonly T[]) => readonly T[] | U; (target: T[], idx: number, values: Iterable>, orElse: (target: readonly NoInfer[]) => U): T[] | U; (target: readonly T[], idx: number, values: Iterable>, orElse: (target: readonly NoInfer[]) => U): readonly T[] | U; }; //#endregion export { insertAllAtOrElse };