//#region src/Array/insertAtOrElse.d.ts /** * # insertAtOrElse * * ```ts * function Array.insertAtOrElse( * target: readonly T[], * idx: number, * value: NoInfer, * orElse: (target: readonly NoInfer[]) => U, * ): T[] | U * ``` * * Inserts `value` at the specified `index` in `array`, returning a new array with the inserted 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.insertAtOrElse([1, 2, 3], 10, 99, (arr) => arr.length); // 3 * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, 2, 3], * Array.insertAtOrElse(10, 99, (arr) => arr.length), * ); // 3 * ``` * */ declare const insertAtOrElse: { (idx: number, value: NoInfer, orElse: (target: readonly NoInfer[]) => U): (target: readonly T[]) => T[] | U; (target: readonly T[], idx: number, value: NoInfer, orElse: (target: readonly NoInfer[]) => U): T[] | U; }; //#endregion export { insertAtOrElse };