left-align

1.0.1 • Public • Published

left-align Build Status

Left align text to a column

Install

$ npm install --save left-align

Usage

const leftAlign = require('left-align');
 
let leftAligned = leftAlign([
    ['One', 'Two', 'Three', 'Four'],
    ['Two', 'Three', 'Four', 'Five'],
    ['Three', 'Four', 'Five', 'Six']
]);
 
//=> One      Two      Three    Four
//   Two      Three    Four     Five
//   Three    Four     Five     Six

API

leftAlign(lines)

Returns a string of the table.

lines

Type: Array(Array(String))

This needs to be a valid 2D array. Every index in the Array should be an Array, and that Array should contain strings respectively.

Inspiration

I made this because I needed a simple left aligned columned table without a 20 configuration lines, and I couldn't find it. 😕

License

MIT © Lukasz Brodowski

Package Sidebar

Install

npm i left-align

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • lukebro