columnize-array
About | Installation | API | License
About
A Node.js module to columnize an array of strings for printing to the terminal.
Installation
Install and require as a standard Node module.
Install
$ npm install --save columnize-array
Require
var columnize =
API
columnize(array, options)
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*/}