aligns

2.0.0 • Public • Published

npm package

build status Coverage Status Dependency Status NPM download NPM quality

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.

Readme

Keywords

Package Sidebar

Install

npm i aligns

Weekly Downloads

1

Version

2.0.0

License

ISC

Unpacked Size

13.6 kB

Total Files

8

Last publish

Collaborators

  • mike442144