tableize-string
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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                  ║
╚═══════════════════════╩═══════════════════════╩═══════════════════════╝

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i tableize-string

    Weekly Downloads

    4

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    18.5 kB

    Total Files

    7

    Last publish

    Collaborators

    • basproul