Skip to content
forked from hustcc/word-table

◼️ a simple javascript (browserjs / nodejs) library for drawing tables in the terminal / console, unicode supported.

License

Notifications You must be signed in to change notification settings

byhgj/word-table

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

word-table

This fork resolved data without header.

word-table is a simple javascript (browserjs / nodejs) library for drawing ascii tables in the terminal / console. Based on word-width.

Build Status npm npm npm

screenshot

1. Install & Import

npm install word-table

  • Import it with script tag in HTML.
<script type="text/javascript" src="word-width.min.js"></script>
<script type="text/javascript" src="dist/word-table.min.js"></script>
  • Import it with require.
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());

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. Test

npm install

npm test

Or you can open the website, then test it in Console [F12].

4. LICENSE

MIT

About

◼️ a simple javascript (browserjs / nodejs) library for drawing tables in the terminal / console, unicode supported.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 64.9%
  • HTML 35.1%