console-table-printer 2.15.0 → 2.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,7 +39,7 @@ const renderWidthLimitedLines = (tableStyle, columns, row, colorMap, isHeader, c
|
|
|
39
39
|
return ret;
|
|
40
40
|
};
|
|
41
41
|
const transformRow = (row, columns) => {
|
|
42
|
-
const transformedRow =
|
|
42
|
+
const transformedRow = Object.assign(Object.assign({}, row), { text: Object.assign({}, row.text) });
|
|
43
43
|
const transforms = {};
|
|
44
44
|
columns
|
|
45
45
|
.filter((c) => {
|
|
@@ -17,23 +17,23 @@ class TableInternal {
|
|
|
17
17
|
}
|
|
18
18
|
initDetailed(options) {
|
|
19
19
|
var _a;
|
|
20
|
-
this.title =
|
|
21
|
-
this.tableStyle = Object.assign(Object.assign({}, this.tableStyle), options
|
|
22
|
-
this.sortFunction =
|
|
23
|
-
this.filterFunction =
|
|
24
|
-
this.enabledColumns =
|
|
25
|
-
this.disabledColumns =
|
|
26
|
-
this.computedColumns =
|
|
20
|
+
this.title = options.title || this.title;
|
|
21
|
+
this.tableStyle = Object.assign(Object.assign({}, this.tableStyle), options.style);
|
|
22
|
+
this.sortFunction = options.sort || this.sortFunction;
|
|
23
|
+
this.filterFunction = options.filter || this.filterFunction;
|
|
24
|
+
this.enabledColumns = options.enabledColumns || this.enabledColumns;
|
|
25
|
+
this.disabledColumns = options.disabledColumns || this.disabledColumns;
|
|
26
|
+
this.computedColumns = options.computedColumns || this.computedColumns;
|
|
27
27
|
this.columns =
|
|
28
|
-
((_a = options
|
|
29
|
-
this.rowSeparator =
|
|
30
|
-
this.charLength =
|
|
28
|
+
((_a = options.columns) === null || _a === void 0 ? void 0 : _a.map((column) => (0, input_converter_1.rawColumnToInternalColumn)(column, options.defaultColumnOptions))) || this.columns;
|
|
29
|
+
this.rowSeparator = options.rowSeparator || this.rowSeparator;
|
|
30
|
+
this.charLength = options.charLength || this.charLength;
|
|
31
31
|
this.defaultColumnOptions =
|
|
32
|
-
|
|
33
|
-
if (options
|
|
32
|
+
options.defaultColumnOptions || this.defaultColumnOptions;
|
|
33
|
+
if (options.shouldDisableColors) {
|
|
34
34
|
this.colorMap = {};
|
|
35
35
|
}
|
|
36
|
-
else if (options
|
|
36
|
+
else if (options.colorMap) {
|
|
37
37
|
this.colorMap = Object.assign(Object.assign({}, this.colorMap), options.colorMap);
|
|
38
38
|
}
|
|
39
39
|
if (options.rows !== undefined) {
|
|
@@ -59,7 +59,7 @@ class TableInternal {
|
|
|
59
59
|
if (options instanceof Array) {
|
|
60
60
|
this.initSimple(options);
|
|
61
61
|
}
|
|
62
|
-
else if (typeof options === 'object') {
|
|
62
|
+
else if (typeof options === 'object' && options !== null) {
|
|
63
63
|
this.initDetailed(options);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -84,9 +84,7 @@ class TableInternal {
|
|
|
84
84
|
}
|
|
85
85
|
addRow(text, options) {
|
|
86
86
|
this.createColumnFromRow(text);
|
|
87
|
-
this.rows.push((0, table_helpers_1.createRow)((options === null || options === void 0 ? void 0 : options.color) || table_constants_1.DEFAULT_ROW_FONT_COLOR, text, (options === null || options === void 0 ? void 0 : options.separator) !== undefined
|
|
88
|
-
? options === null || options === void 0 ? void 0 : options.separator
|
|
89
|
-
: this.rowSeparator));
|
|
87
|
+
this.rows.push((0, table_helpers_1.createRow)((options === null || options === void 0 ? void 0 : options.color) || table_constants_1.DEFAULT_ROW_FONT_COLOR, text, (options === null || options === void 0 ? void 0 : options.separator) !== undefined ? options.separator : this.rowSeparator));
|
|
90
88
|
}
|
|
91
89
|
addRows(toBeInsertedRows, options) {
|
|
92
90
|
toBeInsertedRows.forEach((toBeInsertedRow) => {
|
|
@@ -3,7 +3,7 @@ import { ALIGNMENT, CharLengthDict, COLOR, Dictionary } from './common';
|
|
|
3
3
|
import { TableStyleDetails as InternalTableStyleDetails } from './internal-table';
|
|
4
4
|
export { ALIGNMENT, COLOR };
|
|
5
5
|
export type TableStyleDetails = Partial<InternalTableStyleDetails>;
|
|
6
|
-
export type CellValue = string | number | boolean | undefined | null;
|
|
6
|
+
export type CellValue = string | number | bigint | boolean | undefined | null;
|
|
7
7
|
export type Valuetransform = (cellValue: CellValue) => CellValue;
|
|
8
8
|
/**
|
|
9
9
|
* Configuration options for a table column
|
|
@@ -56,7 +56,7 @@ const findLenOfColumn = (column, rows, charLength) => {
|
|
|
56
56
|
const columnId = column.name;
|
|
57
57
|
const columnTitle = column.title;
|
|
58
58
|
const datatransform = column.transform;
|
|
59
|
-
let length = max(0,
|
|
59
|
+
let length = max(0, column.minLen || 0);
|
|
60
60
|
if (column.maxLen) {
|
|
61
61
|
// if customer input is mentioned a max width, lets see if all other can fit here
|
|
62
62
|
// if others cant fit find the max word length so that at least the table can be printed
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "console-table-printer",
|
|
3
|
-
"version": "2.15.
|
|
4
|
-
"repository":
|
|
3
|
+
"version": "2.15.3",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/console-table-printer/console-table-printer.git"
|
|
7
|
+
},
|
|
5
8
|
"description": "Printing pretty tables on console log",
|
|
6
9
|
"main": "dist/index.js",
|
|
7
10
|
"types": "dist/index.d.ts",
|
|
@@ -26,22 +29,22 @@
|
|
|
26
29
|
"author": "Nahiyan Kamal",
|
|
27
30
|
"license": "MIT",
|
|
28
31
|
"devDependencies": {
|
|
29
|
-
"@eslint/js": "^
|
|
32
|
+
"@eslint/js": "^10.0.1",
|
|
30
33
|
"@semantic-release/changelog": "^6.0.3",
|
|
31
34
|
"@semantic-release/git": "^10.0.1",
|
|
32
35
|
"@types/jest": "^30.0.0",
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"eslint": "^
|
|
36
|
+
"@types/node": "^25.9.1",
|
|
37
|
+
"eslint": "^10.4.0",
|
|
35
38
|
"eslint-config-prettier": "^10.1.8",
|
|
36
|
-
"eslint-plugin-prettier": "^5.5.
|
|
39
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
37
40
|
"husky": "^9.1.7",
|
|
38
|
-
"jest": "^30.2
|
|
39
|
-
"prettier": "^3.
|
|
41
|
+
"jest": "^30.4.2",
|
|
42
|
+
"prettier": "^3.8.3",
|
|
40
43
|
"pretty-quick": "^4.2.2",
|
|
41
|
-
"semantic-release": "^25.0.
|
|
42
|
-
"ts-jest": "^29.4.
|
|
43
|
-
"typescript": "^
|
|
44
|
-
"typescript-eslint": "^8.
|
|
44
|
+
"semantic-release": "^25.0.3",
|
|
45
|
+
"ts-jest": "^29.4.11",
|
|
46
|
+
"typescript": "^6.0.3",
|
|
47
|
+
"typescript-eslint": "^8.60.0"
|
|
45
48
|
},
|
|
46
49
|
"homepage": "https://console-table.netlify.app",
|
|
47
50
|
"dependencies": {
|