Registry / devops / table-style

table-style

JSON →
library0.1.4jsnpmunverified

CLI table output formatter for Node.js with TypeScript support. Current stable version 0.1.4, released sporadically. Provides a typed Table class with customizable borders, column alignment, grouping, and row styling. Unlike many CLI table libraries, it offers built-in group rendering and fine-grained border control. Ships TypeScript definitions and requires Node >= 6.0.

npm install table-style
INSTALL
IMPORT
SIG · TABLE-STYLE
T
table-style
devopsjavascriptv0.1.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Table
import { Table } from 'table-style'
import Table from 'table-style'
This is a named export, not a default export.
Table (CommonJS)
const { Table } = require('table-style')
const Table = require('table-style')
CommonJS must destructure the named export.
types (TypeScript)
import type { TableOptions, Column, RowStyle } from 'table-style'
Type imports are available since the package ships TypeScript definitions.

Creates a typed table with groups, styled header, and aligned columns, then renders to stdout.

import { Table } from 'table-style'; interface User { name: string; role: string; office: string; } const users: User[] = [ { name: 'Alice', role: 'Engineer', office: 'NY' }, { name: 'Bob', role: 'Manager', office: 'SF' }, ]; 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' } }, ], }); // Write to stdout const output = table.render(users); process.stdout.write(output);
Debug
Known issues
gotchaThe render method returns a string; it does not write to a stream directly. The example in the README shows table.render(users, process.out) which is incorrect.
fix
Replace table.render(users, process.out) with process.stdout.write(table.render(users))
affects: >=0.0.0
gotchaThe border property in options expects a string (e.g., 'single', 'double', 'none') but rowStyles.border accepts an object with top and bottom.
fix
For rowStyles, use { border: { top: 'single', bottom: 'double' } } rather than a string.
affects: >=0.0.0
gotchaColor support depends on the terminal; foregroundColor and backgroundColor options may not work in all environments.
fix
Test in target terminals or use without colors.
affects: >=0.0.0
deprecatedThe second argument to render() (output stream) is deprecated and may be removed in future versions.
fix
Do not pass a second argument; capture the returned string and write it manually.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: table.render is not a function
Table imported incorrectly as default instead of named export.
fix
Use import { Table } from 'table-style' instead of import Table from 'table-style'.
Cannot find module 'table-style'
Package not installed or incorrect import path.
fix
Run npm install table-style and ensure import path is 'table-style' (no relative path).
Property 'render' does not exist on type 'typeof Table'
Attempting to call Table.render() as a static method, but render is an instance method.
fix
Create an instance first: const table = new Table(options); table.render(data);
Upgrade
Version history
0.1.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Resources
table-style — npm install table-style · libregistry