JSPM

  • Created
  • Published
  • Downloads 20807991
  • Score
    100M100P100Q230353F

Node Tables

Package Exports

  • table

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (table) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

About

table is a component to create text based tables. This might be useful for text emails or to display tables in the CLI.

Install

npm install table

Example

var sys = require('sys'), table = require('table').table({ 'columnWidths': [15, 20] });

table
    .setDefaultColumnAlignment(['left', 'center'])
    .appendRow(['Node', 'Table'])
    .appendRow(['Second', 'Row'])
    .appendRow(['Third', 'Row'])
    .appendRow(["Fourth\nsecond line", 'Row']);
sys.puts(table.render());

Results in a nice looking table:

+---------------+--------------------+
|Node           |       Table        |
|---------------+--------------------|
|Second         |        Row         |
|---------------+--------------------|
|Third          |        Row         |
|---------------+--------------------|
|Fourth         |        Row         |
|second line    |                    |
+---------------+--------------------+

Valid alignments are 'left', 'center' and 'right'.

TODOs

  • Handle Row Objects as well as arrays in appendRow
  • Some proper testing