JSPM

  • Created
  • Published
  • Downloads 20922239
  • Score
    100M100P100Q226914F

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());

will result in a nice looking table:

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

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

Test

To run the test simply call

node test/render.test.js