UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

22 lines 809 B
//#region src/array/insertAllAt.d.ts /** * `insertAllAt(array, index, values)` * * Inserts all elements from `values` at the specified `index` in `array`, returning a new array with the inserted elements. Supports iterables for the `values` parameter. * * ```ts * insertAllAt([1, 2, 3], 1, [10, 20]); // [1, 10, 20, 2, 3] * ``` * * ```ts * pipe([1, 2, 3], insertAllAt(1, [10, 20])); // [1, 10, 20, 2, 3] * ``` */ declare const insertAllAt: { <T>(idx: number, values: Iterable<NoInfer<T>>): (target: T[]) => T[]; <T>(idx: number, values: Iterable<NoInfer<T>>): (target: readonly T[]) => readonly T[]; <T>(target: T[], idx: number, values: Iterable<NoInfer<T>>): T[]; <T>(target: readonly T[], idx: number, values: Iterable<NoInfer<T>>): readonly T[]; }; //#endregion export { insertAllAt };