Return the maximum number of columns in any row
Return the number of rows
Return a copy of table as nested array
const t = new Table();
// add stuff
// ...
const m = t.asArray();
for (const row of m) {
for (const colValue of row) {
// iterate over all column values for this row
}
}
Alternative: get value at row Y and column X
const value = m[y][x];
Gets the value at a specified row and column. Throws an error if coordinates are out of range or missing.
Row index or label
Column index or label
Gets the label for a given column index, returning undefined if not found.
Case-sensitive
Label to seek
Index of column, or undefined if not found
Gets the label for a given row index, returning undefined if not found.
Case-sensitive
Label to seek
Index of row, or undefined if not found
Gets a row along with labels, as an array
Return a row of objects. Keys use the column labels.
const row = table.getRowWithLabelsObject(10);
// eg:
// [{ colour: red, size: 10}, { colour: blue, size: 20 }]
Assign label to a specific column First column has an index of 0
Assign labels to columns
Assign label to a specific row First row has an index of 0
Label rows
Labels
Dumps the values of the table to the console
Gets a copy of values at given row, specified by index or label
Returns row or throws an error if label or index not found
Iterates over each row, including the labels if available
rowsWithLabelsObject to get rows in object format
Iterates over the table row-wise, in object format.
rowsWithLabelsArray to get rows in array format
Set the value of row,columm. Row is created if it doesn't exist, with the other column values being undefined
Index or label
Column
Value to set at row,column
Set all the columns of a row to a specified value.
By default, sets the number of columns corresponding to
the table's maximum column length. To set an arbitrary
length of the row, use length
Index or label of row
Value to set
Optional
length: numberHow wide the row is. If unset, uses the current maximum width of rows.
Stores values in a table of rows (vertical) and columns (horizontal)