About | Installation | API | License
A Node.js module to columnize an array of strings for printing to the terminal.
Install and require as a standard Node module.
Install
$ npm install --save columnize-array
Require
var columnize = require('columnize-array')
array
— Array — strings to columnizeoptions
— Object — customizable options
var defaultOptions =
{ gap:
{ len: 2
, ch: ' '
}
, maxRowLen: 80
, sort: false
}
gap.len
— Number — minimum character width of gap between columnsgap.ch
— String — character to use in gapmaxRowLen
— Number — maximum character count of each rowsort
— Boolean or Function — whether to sortarray
param;true
usesArray.prototype.sort()
, or you can provide your own sort functionfunction(array) {/*sorting logic*/}