zlsoftdq / word-table

word-table is simple javascript library for drawing tables in the terminal/console. Chinese supported

Home Page:http://git.hust.cc/word-table

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

word-table

word-table is simple javascript library for drawing ascii tables in the terminal / console.

Build Status npm npm npm

1. Install & Import

npm install word-table

var WorkTable = require('word-table');
//or
import WorkTable from 'word-table';

2. Usage & API

See a demo firstly:

var header = ['id', 'name', 'birthday'];
var body = [
  ['#1', '王小为', '1992-08-01', '备注:hustcc'], 
  ['#2', '小泥巴', '1992-09-20'],
  ['#3', '佚名', '保密']
];

// basic usage
var wt = new WordTable(header, body);
console.log(wt.string());

screenshot

The API is so simple that documents are not needed.

wt.setHeader(['id', 'name', 'birthday']);
wt.appendBody(['#3', '佚名', '保密']);
wt.setBody([['#4', '在线工具', '保密', 'atool.org']]);
wt.array();
wt.string();
wt.reset();

Detail usage and demo code, can see here, and run npm test can see the output.

3. TODO

  • Browser Javascript supported.

4. Test

npm install

npm test

5. LICENSE

MIT

About

word-table is simple javascript library for drawing tables in the terminal/console. Chinese supported

http://git.hust.cc/word-table

License:MIT License


Languages

Language:JavaScript 68.8%Language:HTML 31.2%