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

0.1.4 • Public • Published

table-style

CLI Table formatter for NodeJS

Installing

For the latest stable version:

npm install table-style

Usage

import { Table } from "table-style";
 
interface User {
    name: string;
    role: string;
    office: string;
}
 
const table = new Table<User>({
    border: "single",
    groups: [
        { by: user => user.role }
    ],
    columns: [
        { header: "name", expression: x => x.name },
        { header: "office", expression: x => x.office, align: "right" }
    ],
    rowStyles: [
        { section: "header", border: { bottom: "double" }, foregroundColor: "white" },
        { section: "body", border: { top: "none", bottom: "none" } }
    ]
});
 
table.render(users, process.out);

API

Readme

Keywords

none

Package Sidebar

Install

npm i table-style

Weekly Downloads

1,303

Version

0.1.4

License

Apache-2.0

Last publish

Collaborators

  • rbuckton