- table-layout
- Table ⏏
- new Table(data, [options])
- table.load(data)
- table.renderLines() ⇒
Array.<string>
- table.toString() ⇒
string
- Table~columnOption
- Table ⏏
Recordset data in (array of objects), text table out.
Params
- data
Array.<object>
- input data - [options]
object
- optional settings- [.maxWidth]
number
- maximum width of layout - [.noWrap]
boolean
- disable wrapping on all columns - [.noTrim]
boolean
- disable line-trimming - [.break]
boolean
- enable word-breaking on all columns - [.columns]
columnOption
- array of column-specific options - [.ignoreEmptyColumns]
boolean
- If set, empty columns or columns containing only whitespace are not rendered. - [.padding]
object
- Padding values to set on each column. Per-column overrides can be set in theoptions.columns
array.- [.left]
string
- Defaults to a single space. - [.right]
string
- Defaults to a single space.
- [.left]
- [.eol]
string
- EOL character used. Defaults to\n
.
- [.maxWidth]
Set the input data to display. Must be an array of objects.
Kind: instance method of Table
Params
- data
Array.<object>
Identical to .toString()
with the exception that the result will be an array of lines, rather than a single, multi-line string.
Kind: instance method of Table
Returns the input data as a text table.
Kind: instance method of Table
Kind: inner typedef of Table
Properties
Name | Type | Description |
---|---|---|
name | string |
column name, must match a property name in the input |
[width] | number |
A specific column width. Supply either this or a min and/or max width. |
[minWidth] | number |
column min width |
[maxWidth] | number |
column max width |
[nowrap] | boolean |
disable wrapping for this column |
[break] | boolean |
enable word-breaking for this columns |
[padding] | object |
padding options |
[padding.left] | string |
a string to pad the left of each cell (default: ' ' ) |
[padding.right] | string |
a string to pad the right of each cell (default: ' ' ) |
[get] | function |
A getter function to return the cell value, the function receives the existing cell value. Signature: function (cellValue) { // return the desired cell value } |