Returns a new array with a value inserted at the specified index.
const numbers = [1, 2, 4] as const;const withThree = Arr.toInserted(numbers, 2, 3);const appendFive = Arr.toInserted(3, 5)(numbers);assert.deepStrictEqual(withThree, [1, 2, 3, 4]);assert.deepStrictEqual(appendFive, [1, 2, 4, 5]); Copy
const numbers = [1, 2, 4] as const;const withThree = Arr.toInserted(numbers, 2, 3);const appendFive = Arr.toInserted(3, 5)(numbers);assert.deepStrictEqual(withThree, [1, 2, 3, 4]);assert.deepStrictEqual(appendFive, [1, 2, 4, 5]);
Returns a new array with a value inserted at the specified index.