aligns
v2.0.0
Published
align array or table(2D array)
Downloads
28
Readme
Aligns
A tool to align array or table
Table of Contents
Installation
$ npm install aligns
Usage
Align an array
const align = require('aligns');
const xs = ['Ludwig van Beethoven', 'Beyond', 'Michael Jackson', 'Wolfgang Amadeus Mozart'];
const aligned = align.alignLeft(0, xs);
/*
[ 'Ludwig van Beethoven ',
'Beyond ',
'Taylor Swift ',
'Wolfgang Amadeus Mozart' ]
*/
Align a table
const align = require('aligns');
const xss = [
['Ludwig van Beethoven', 'Wolfgang Amadeus Mozart'],
['Symphony No.9 in D minor op.125', 'Le nozze di Figaro K.492'],
['Symphony No.5 in C minor op.67', 'Serenade No.13 K.525']
];
const aligned = align.alignTableL(xss);
/*
[ [ 'Ludwig van Beethoven ','Wolfgang Amadeus Mozart ' ],
[ 'Symphony No.9 in D minor op.125','Le nozze di Figaro K.492' ],
[ 'Symphony No.5 in C minor op.67 ','Serenade No.13 K.525 ' ] ]
*/
API
Align.left(indent, xs)
Align an array of String to left.
Align.right(indent, xs)
Align an array of String to right.
Align.center(indent, xs)
Align an array of String to center.
Align.tableL(xss)
xss
<Array> 2D array of String
Align each column to left.
Align.tableR(xs)
xss
<Array> 2D array of String
Align each column to right.
Align.table(xs)
xss
<Array> 2D array of String
Align each column to center.