Socket
Book a DemoInstallSign in
Socket

obj-to-table

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

obj-to-table

Create a table from an array of objects

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

obj-to-table Build Status

Create a table from an array of objects

Install

$ npm install --save obj-to-table

Usage

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          │
└──────────────┴──────────────┴──────────────┘
*/

API

objToTable(data, [options])

data

Type: Array Object

An array of objects containing your data.

options

Type: Object

See the cli-table options.

License

MIT © Kevin Martensson

Keywords

array

FAQs

Package last updated on 27 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts