xpl / as-table

A simple function that prints objects as ASCII tables. Supports ANSI styling and weird Unicode 💩 emojis – they won't break the layout.
http://npmjs.com/package/as-table
MIT License
62 stars 10 forks source link

how to print header if data is an array ? #10

Closed k2s closed 4 years ago

xpl commented 4 years ago

Just transform it to objects:

const data = [
    ['John', 35],
    ['Kyle', 21]
]

console.log (asTable (data.map (([name, age]) => ({ name, age }))))
name  age
---------
John  35 
Kyle  21