The type of the elements in the rows.
The 2D array representing the table.
Optional
headers: string[]The headers to use as keys for the objects. If not provided, the first row of the table is used as headers.
Optional
ignoreKeys: Set<string>An array of objects, where each object represents a row in the table.
Throws an error if the headers are not provided and the table is empty or only contains one row.
const table = [
['Name', 'Age', 'Country'],
['John', 25, 'USA'],
['Jane', 30, 'Canada'],
];
const headers = ['Name', 'Age', 'Country'];
arrTableToObjects(table, headers) //=> [
// { Name: 'John', Age: 25, Country: 'USA' },
// { Name: 'Jane', Age: 30, Country: 'Canada' },
// ]
Generated using TypeDoc
Converts a 2D array representing a table into an array of objects.