wide-align
A wide-character aware text alignment function for use in terminals / on the console.
Usage
1 | var align = require('wide-align') |
Functions
align.center(str, length) → str
Returns str with spaces added to both sides such that that it is length chars long and centered in the spaces.
align.left(str, length) → str
Returns str with spaces to the right such that it is length chars long.
align.right(str, length) → str
Returns str with spaces to the left such that it is length chars long.
Origins
These functions were originally taken from cliui. Changes include switching to the MUCH faster pad generation function from lodash, making center alignment pad both sides and adding left alignment.