Skip to content
node.js Text Table Renderer
CoffeeScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
spec
src
.gitignore
Cakefile
LICENCE
README.md
package.json

README.md

No longer maintained. Development has moved to https://github.com/gajus/table

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 util = require('util'), Table = require('table');

var table = new Table( [15, 20] );
table
    .setDefaultColumnAlignment(['left', 'center'])
    .appendRow(['Node', 'Table'])
    .appendRow(['Second', 'Row'])
    .appendRow(['Third', 'Row'])
    .appendRow(["Fourth\nsecond line", 'Row']);
util.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'.

Build

To build the project call

cake build

Test

To run the test simply call

cake test
Something went wrong with that request. Please try again.