package
Render tables in text for tabular terminal fun times!
npm install asciitableGitHub-flavored package documentation.
Across all versions, last 30 days.
2,107 in 30 days
Runtime metadata.
Tagged topics.
Render tables in text for tabular terminal fun times!
asciitable is the result of me extracting some code from another project. It can render simple tables with headings and pretty hyphen/pipe character-based formatting.
Available via npm:
$ npm install asciitable
Or via git:
$ git clone git://github.com/deoxxa/asciitable.git node_modules/asciitable
asciitable
Generates a table! Easy as pie!
var table = asciitable([options], data);// basic table
var table = asciitable([
{a: "a", b: "b", c: "c"},
{a: "asddsfa", b: "sss", c: "zxc"},
{a: "dsgvdgsdvgssdf", b: "x", c: "eryty"},
{a: "m", b: "n", c: "o", d: "p"},
]);
console.log(table);Arguments
Options
Also see example.js.
var asciitable = require("asciitable");
var table = asciitable([
{a: "a", b: "b", c: "c"},
{a: "asddsfa", b: "sss", c: "zxc"},
{a: "dsgvdgsdvgssdf", b: "x", c: "eryty"},
{a: "m", b: "n", c: "o", d: "p"},
{a: 5, b: null, c: {}, d: []},
{a: function(){}},
]);
console.log(table);Output:
-------------------------------------------------
| a | b | c | d |
-------------------------------------------------
| a | b | c | |
| asddsfa | sss | zxc | |
| dsgvdgsdvgssdf | x | eryty | |
| m | n | o | p |
| 5 | null | [object Object] | |
| function (){} | | | |
-------------------------------------------------3-clause BSD. A copy is included with the source.