Create a table from an array of objects
$ npm install --save obj-to-table
const objToTable = require('obj-to-table');
const table = objToTable([{
foo: 'bar',
cat: 'meow',
unicorn: 'moo'
}, {
foo: 'crow',
cat: 'eek',
unicorn: 'buzz'
}, {
foo: 'ow',
cat: 'hee-haw',
unicorn: 'hum'
}]);
console.log(table.toString());
/*
┌──────────────┬──────────────┬──────────────┐
│ foo │ cat │ unicorn │
├──────────────┼──────────────┼──────────────┤
│ bar │ meow │ moo │
├──────────────┼──────────────┼──────────────┤
│ crow │ eek │ buzz │
├──────────────┼──────────────┼──────────────┤
│ ow │ hee-haw │ hum │
└──────────────┴──────────────┴──────────────┘
*/
Type: Array
Object
An array of objects containing your data.
Type: Object
See the cli-table options.
MIT © Kevin Martensson