Add header to a text table, with border.
Text table is array of rows of equal length:
var table = [
['red', '#ff0000'],
['green', '#00ff00'],
['blue', '#0000ff']
];
Example
var tableHeader = require('table-header');
tableHeader(table, ['color', 'code'])
API
Returns a new table with header
and the same data.
Options:
-
border
— false
for no border, true
(default) for -
-delimited border, single-character string for custom-delimited border.
-
stringLength
— string length function, e.g. to ignore escape codes.
Add header to existing table
, modifying it.
Related
Install
npm install table-header
License
MIT