Narwhals Playing Mahjong

    table-header

    0.2.2 • Public • Published

    npm

    table-header

    Build Status Dependency Status

    Add header to a text table, with border.

    Text table is array of rows of equal length:

    var table = [
      ['red', '#ff0000'],
      ['green', '#00ff00'],
      ['blue', '#0000ff']
    ];

    Example

    var tableHeader = require('table-header');
     
    tableHeader(table, ['color', 'code'])
    //=> [
    //     ['color', 'code'],
    //     ['-----', '-------'],
    //     ['red', '#ff0000'],
    //     ['green', '#00ff00'],
    //     ['blue', '#0000ff']
    //   ]

    API

    tableHeader(table, header, [opts])

    Returns a new table with header and the same data.

    Options:

    • borderfalse for no border, true (default) for --delimited border, single-character string for custom-delimited border.

    • stringLength — string length function, e.g. to ignore escape codes.

    tableHeader.add(table, header, [opts])

    Add header to existing table, modifying it.

    Related

    • text-table module turns these tables to strings.
    • string-length — string length function that ignores escape codes.

    Install

    npm install table-header
    

    License

    MIT

    Install

    npm i table-header

    DownloadsWeekly Downloads

    1,200

    Version

    0.2.2

    License

    MIT

    Last publish

    Collaborators

    • eush77