-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
NB10328
authored and
NB10328
committed
Mar 3, 2022
1 parent
f447c46
commit 5d4245e
Showing
3 changed files
with
96 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* Type definition for table section style. | ||
* @typedef {Object} SectionStyle | ||
* @property {string} left The left border character. | ||
* @property {string} center The center border character. | ||
* @property {string} right The right border character. | ||
* @property {string} colSeparator The column separator character. | ||
*/ | ||
export type SectionStyle = { | ||
left: string, | ||
center: string, | ||
right: string, | ||
colSeparator: string | ||
}; | ||
|
||
/** | ||
* Borders style definition. | ||
* @typedef {Object} Borders | ||
* @property {SectionStyle} top The style for top section borders (above heading). | ||
* @property {SectionStyle} middle The style for middle section borders (between heading and data). | ||
* @property {SectionStyle} bottom The style for bottom section borders (below data). | ||
* @property {SectionStyle} data The style for data row borders. | ||
*/ | ||
export type Borders = { | ||
top: SectionStyle, | ||
middle: SectionStyle, | ||
bottom: SectionStyle, | ||
data: SectionStyle | ||
}; | ||
|
||
/** | ||
* Type definition for a table style. | ||
* @typedef {Object} Style | ||
* @property {string} name Style name. | ||
* @property {Borders} borders The border styles for each section. | ||
*/ | ||
export type Style = { | ||
name: string, | ||
borders: Borders | ||
}; | ||
|
||
/** | ||
* @typedef {object} ColumnFormatJSON | ||
* @property {number[]} aligns Alignment setting for each data column. | ||
* @property {number[]} widths Width setting for each data column. | ||
* @property {boolean[]} wrappings Wrapping setting for each data column. | ||
*/ | ||
export type ColumnFormatJSON = { | ||
aligns: number[], | ||
widths: number[], | ||
wrappings: boolean[] | ||
}; | ||
|
||
/** | ||
* @typedef {object} FormattingJSON | ||
* @property {number} titleAlign Title alignment setting. | ||
* @property {ColumnFormatJSON} columns Format settings for each column. | ||
* @property {boolean} justify Whether to justify table columns. | ||
*/ | ||
export type FormattingJSON = { | ||
titleAlign: number, | ||
columns: ColumnFormatJSON, | ||
justify: boolean | ||
}; | ||
|
||
/** | ||
* @typedef {object} TableJSON | ||
* @property {string} title Table title text. | ||
* @property {string[]} heading Array of table column headings. | ||
* @property {string[][]} rows Array of table rows (each row contains an array of data columns). | ||
* @property {FormattingJSON} formatting Table formatting settings. | ||
*/ | ||
export type TableJSON = { | ||
title: string, | ||
heading: string[], | ||
rows: string[][], | ||
formatting: FormattingJSON | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "ascii-table3", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"author": "João Simões <[email protected]> (https://github.com/AllMightySauron)", | ||
"description": "Javascript ASCII renderer for beautiful console-based tables", | ||
"repository": { | ||
|