Array of objects to display as table rows
Optional
options: Object = {}Configuration options
Outputs table directly to console
const users = [
{ name: 'John', age: 30, city: 'NYC' },
{ name: 'Jane', age: 25, city: 'LA' }
];
table(users);
// ┌──────┬─────┬─────┐
// │ name │ age │ city│
// ├──────┼─────┼─────┤
// │ John │ 30 │ NYC │
// │ Jane │ 25 │ LA │
// └──────┴─────┴─────┘
table(users, { headers: ['Name', 'Age', 'Location'] });
Render array of objects as formatted table with Unicode borders.
Algorithm: Calculate max column widths, generate border/data rows, output via console.log. Uses object keys as default headers.
Column Width: Max of header length and longest data value per column. Data Handling: Missing properties become empty strings. Edge Cases: Empty arrays, no columns, all-null values handled.