1.0.3 • Published 7 years ago

good-table v1.0.3

Weekly downloads
6
License
ISC
Repository
github
Last release
7 years ago

Good Table

format array of arrays as a table with no config

const table = require('good-table')
const formatted = table([
  [ 'Name', 'ID', 'Price' ],
  [ '----', '--', '-----' ],
  [ 'Thing 1', '10', '$100' ],
  [ 'Thing 2', '451', '$5000' ],
  [ 'Third Thing', '3', '$5' ]
])

console.log(formatted)
/*
Name         ID   Price
----         --   -----
Thing 1      10   $100 
Thing 2      451  $5000
Third Thing  3    $5   
*/

You can pass the number of spaces in padding as the second argument if you want.