splice rows of a row-major 2D array and optionally insert new rows at the specified start index.

delete 1 row from arr2d (starting at row-index 1), and insert 2 new rows in its place.

import { assertEquals } from "jsr:@std/assert"

const arr2d: Array2DRowMajor<number> = [
[1 , 2 , 3 , 4 , 5 ],
[6 , 7 , 8 , 9 , 10],
[11, 12, 13, 14, 15],
]
const deleted_rows = spliceArray2DMajor(arr2d, 1, 1,
[21, 22, 23, 24, 25],
[31, 32, 33, 34, 35]
)
assertEquals(arr2d, [
[1 , 2 , 3 , 4 , 5 ],
[21, 22, 23, 24, 25],
[31, 32, 33, 34, 35],
[11, 12, 13, 14, 15],
])
assertEquals(deleted_rows, [
[6 , 7 , 8 , 9 , 10],
])