This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

ascii-pretty-table
TypeScript icon, indicating that this package has built-in type declarations

1.3.2 • Public • Published

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

Package Sidebar

Install

npm i ascii-pretty-table

Weekly Downloads

1

Version

1.3.2

License

ISC

Unpacked Size

8.96 kB

Total Files

7

Last publish

Collaborators

  • imranbarbhuiya