borderless text tables with alignment
generate borderless text table strings suitable for printing to stdout
var table = ;var t = ;console;master 0123456789abcdefstaging fedcba9876543210var table = ;var t = ;console;beep 1024boop 33450foo 1006bar 45var table = ;var t = ;console;beep 1024boop 334.212foo 1006bar 45.6baz 123.var table = ;var t = ;console;beep 1024 xyzboop 3388450 tuvfoo 10106 qrstuvbar 45 lmnovar table = Return a formatted table string s from an array of rows and some options
opts.
rows should be an array of arrays containing strings, numbers, or other
printable values.
options can be:
opts.hsep - separator to use between columns, default ' 'opts.align - array of alignment types for each column, default ['l','l',...]opts.stringLength - callback function to use when calculating the string lengthalignment types are:
'l' - left'r' - right'c' - center'.' - decimalWith npm do:
npm install text-tableSince the string length of ANSI color schemes does not equal the length JavaScript sees internally it is necessary to pass the a custom string length calculator during the main function call.
See the test/ansi-colors.js file for an example.
MIT