Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/lume/deps/cliffy.ts>Table

🔥 Static site generator for Deno 🦕
Very Popular
Latest
class Table
extends Array<T>
Re-export
import { Table } from "https://deno.land/x/lume@v2.4.1/deps/cliffy.ts";

Table representation.

Type Parameters

optional
T extends IRow = IRow

Properties

private
optional
headerRow: Row
protected
options: ITableSettings

Methods

align(direction: Direction, override?): this

Align table content.

body(rows: T[]): this

Set table body.

border(enable: boolean, override?): this

Enable/disable cell border.

chars(chars: IBorderOptions): this

Set border characters.

Clone table recursively with header and options.

fromJson(rows: IDataRow[]): this

Read data from an array of json objects. An object represents a row and each property a column.

Get table alignment.

getBody(): T[]

Get table body.

getBorder(): boolean

Check if table has border.

getHeader(): Row | undefined

Get table header.

getIndent(): number

Get table indentation.

getMaxColWidth(): number | number[]

Get mac col widrth.

getMinColWidth(): number | number[]

Get min col width.

getPadding(): number | number[]

Get cell padding.

hasBodyBorder(): boolean

Check if table bordy has border.

hasBorder(): boolean

Check if table header or body has border.

hasHeaderBorder(): boolean

Check if header row has border.

header(header: IRow): this

Set table header.

indent(width: number, override?): this

Set table indentation.

maxColWidth(width: number | number[], override?): this

Set max col with.

minColWidth(width: number | number[], override?): this

Set min col width.

padding(padding: number | number[], override?): this

Set cell padding.

render(): this

Write table to stdout.

toString(): string

Generate table string.

Static Properties

protected
_chars: IBorder

Static Methods

chars(chars: IBorderOptions): Table

Set global default border characters.

from<T extends IRow>(rows: ITable<T>): Table<T>

Create a new table. If rows is a table, all rows and options of the table will be copied to the new table.

Create a new table from an array of json objects. An object represents a row and each property a column.

render<T extends IRow>(rows: ITable<T>): void

Write table or rows to stdout.