This package has been deprecated

Author message:

this package is no longer maintained and propably broken

format-table

0.0.1 • Public • Published

format-table

Simple table formatter wrapping table-cli

This module wraps the wonderful cli-table to allow you to pass in simle objects and arrays directly, and adds some shortcuts for foratting (e.g. border-style "none", "ascii", "fat" )

Install

npm install format-table

Usage

    var table = require("format-table");
    
    console.log(table({ one: 1, two: 2 }));
    
    // ┌─────┬───┐
    // │ one │ 1 │
    // ├─────┼───┤
    // │ two │ 2 │
    // └─────┴───┘

Examples

    // using a single title

    console.log(table("Helo World", { one: 1, two: 2 }));
    
    // ┌─────────────┬───┐
    // │ Hello World │   │
    // ├─────────────┼───┤
    // │ one         │ 1 │
    // ├─────────────┼───┤
    // │ two         │ 2 │
    // └─────────────┴───┘

    // with multiple titles
    
    console.log(table(["key", "value"], { one: 1, two: 2 }));

    //┌─────┬───────┐
    //│ key │ value │
    //├─────┼───────┤
    //│ one │ 1     │
    //├─────┼───────┤
    //│ two │ 2     │
    //└─────┴───────┘

    // formatting options
    
    console.log(table("No borders please", { one: 1, two: 2 }, "none"));
    
    // No borders please    
    // one                1 
    // two                2 

Readme

Keywords

Package Sidebar

Install

npm i format-table

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • mvhenten