1.3.2 • Published 2 years ago

ascii-pretty-table v1.3.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

npm npm GitHub Build Status Test Status

ascii-pretty-table

ascii-pretty-table, A simple and light weight library for creating ASCII tables.

docs

Uses

Install

npm install ascii-pretty-table

Example

const ascii = require("ascii-pretty-table"); //commonjs
import ascii from "ascii-pretty-table"; //es6

const table = new ascii("A Title");
table.setHeading("Column 1", "Column 2");
table.addRow("Row 1", "Row 2");
table.addRow("Row 3", "Row 4");

console.log(table.toString());

Result

+....................+
|      A Title       |
+''''''''''''''''''''+
| Column 1 | Column 2|
+''''''''''''''''''''+
|   Row 1  |  Row 2  |
+''''''''''''''''''''+
|   Row 3  |  Row 4  |
+''''''''''''''''''''+

You can create table without headings as well.

You can export or import table as JSON.

const ascii = require("ascii-pretty-table");
const table = new ascii("A Title");
table.addRow("Row 1", "Row 2");
table.addRow("Row 3", "Row 4");

const json = table.toJSON();

const newTable = new ascii();
newTable.fromJSON(json);

Change separators

table.setSeparators({
  top: ".",
  bottom: "'",
  edge: "|",
  fill: "-",
  corner: "+",
});

Methods and Properties

read docs for ascii-pretty-table

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.3

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.3

2 years ago

1.1.1

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago