Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ruanyl/table-view
https://github.com/ruanyl/table-view
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ruanyl/table-view
- Owner: ruanyl
- License: mit
- Created: 2015-09-21T20:43:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-25T18:47:57.000Z (over 9 years ago)
- Last Synced: 2024-11-05T14:55:47.483Z (2 months ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
table-view
========
[![build status](https://secure.travis-ci.org/ruanyl/table-view.svg)](http://travis-ci.org/ruanyl/table-view)
[![NPM version](https://badge.fury.io/js/table-view.svg)](http://badge.fury.io/js/table-view)array table view
## Installation
This module is installed via npm:
``` bash
$ npm install table-view
```## Example Usage
``` js
var tableView = require('table-view');var arr = [
['111', '222', '333', '4444'],
['1111111', '222222', '333333', '4444'],
['111', '222', '33333333333', '4444'],
['111', '222', '333', '444444444444']
];
console.log(tableView(arr, {margin: 4, align: 'left'}).output());
```======>
```
111 222 333 4444
1111111 222222 333333 4444
111 222 33333333333 4444
111 222 333 444444444444
```### header
```
console.log(tableView(arr, {margin: 4, align: 'left', header: 'top'}).output());
``````
name class age gender
------------------------------------------------
111 222 333 4444
1111111 222222 333333 4444
111 222 33333333333 4444
111 222 333 444444444444
```### border
```
var style = {
margin: 4,
align: 'left',
header: 'top',
borderLeft: '|',
borderRight: '|',
borderTop: '-',
borderBottom: '-'
};
console.log(tableView(arr, style).output());
``````
----------------------------------------------------
| name class age gender |
| ------------------------------------------------ |
| 111 222 333 4444 |
| 1111111 222222 333333 4444 |
| 111 222 33333333333 4444 |
| 111 222 333 444444444444 |
----------------------------------------------------
```