The 2D array to check.
Optional
headers: string[]Optional. An array of headers. If provided, each row must have the same length as this array.
If any row in the array has a different length than the others.
T - The type of elements in the rows.
const rows = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
arrTableAssertRowsSameLength(rows);
//=> undefined
const rowsWithDifferentLength = [
[1, 2, 3],
[4, 5],
[7, 8, 9],
];
arrTableAssertRowsSameLength(rowsWithDifferentLength);
//=> Error: Expected 3 columns, got 2
Generated using TypeDoc
Asserts that all rows in a 2D array have the same length.