1.0.3 • Published 1 year ago

tableize-string v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Tableize string

This is a tiny package that takes in an input and returns a simple string table.

Example:

import tableize from 'tableize-string';

const data = {
  headers: ['Title', 'Author', 'Date'],
  rows: [
    ['The Hobbit', 'J.R.R. Tolkien', '1937'],
    ['The Lord of the Rings', 'J.R.R. Tolkien', '1954-1955'],
    ['The Silmarillion', 'J.R.R. Tolkien', '1977'],
  ],
}

const table = tableize(data);

console.log(table);

Output:

╔═══════════════════════╦═══════════════════════╦═══════════════════════╗
║ Title                 ║ Author                ║ Date                  ║
╠═══════════════════════╬═══════════════════════╬═══════════════════════╣
║ The Hobbit            ║ J.R.R. Tolkien        ║ 1937                  ║
╠═══════════════════════╬═══════════════════════╬═══════════════════════╣
║ The Lord of the Rings ║ J.R.R. Tolkien        ║ 1954-1955             ║
╠═══════════════════════╬═══════════════════════╬═══════════════════════╣
║ The Silmarillion      ║ J.R.R. Tolkien        ║ 1977                  ║
╚═══════════════════════╩═══════════════════════╩═══════════════════════╝