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 = JSON.parse(JSON.stringify(row));
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 = (options === null || options === void 0 ? void 0 : options.title) || this.title;
21
- this.tableStyle = Object.assign(Object.assign({}, this.tableStyle), options === null || options === void 0 ? void 0 : options.style);
22
- this.sortFunction = (options === null || options === void 0 ? void 0 : options.sort) || this.sortFunction;
23
- this.filterFunction = (options === null || options === void 0 ? void 0 : options.filter) || this.filterFunction;
24
- this.enabledColumns = (options === null || options === void 0 ? void 0 : options.enabledColumns) || this.enabledColumns;
25
- this.disabledColumns = (options === null || options === void 0 ? void 0 : options.disabledColumns) || this.disabledColumns;
26
- this.computedColumns = (options === null || options === void 0 ? void 0 : options.computedColumns) || 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 === null || options === void 0 ? void 0 : options.columns) === null || _a === void 0 ? void 0 : _a.map((column) => (0, input_converter_1.rawColumnToInternalColumn)(column, options === null || options === void 0 ? void 0 : options.defaultColumnOptions))) || this.columns;
29
- this.rowSeparator = (options === null || options === void 0 ? void 0 : options.rowSeparator) || this.rowSeparator;
30
- this.charLength = (options === null || options === void 0 ? void 0 : options.charLength) || 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
- (options === null || options === void 0 ? void 0 : options.defaultColumnOptions) || this.defaultColumnOptions;
33
- if (options === null || options === void 0 ? void 0 : options.shouldDisableColors) {
32
+ options.defaultColumnOptions || this.defaultColumnOptions;
33
+ if (options.shouldDisableColors) {
34
34
  this.colorMap = {};
35
35
  }
36
- else if (options === null || options === void 0 ? void 0 : options.colorMap) {
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, (column === null || column === void 0 ? void 0 : column.minLen) || 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.0",
4
- "repository": "github:console-table-printer/console-table-printer",
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": "^9.38.0",
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": "^24.8.1",
34
- "eslint": "^9.38.0",
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.4",
39
+ "eslint-plugin-prettier": "^5.5.5",
37
40
  "husky": "^9.1.7",
38
- "jest": "^30.2.0",
39
- "prettier": "^3.6.2",
41
+ "jest": "^30.4.2",
42
+ "prettier": "^3.8.3",
40
43
  "pretty-quick": "^4.2.2",
41
- "semantic-release": "^25.0.1",
42
- "ts-jest": "^29.4.5",
43
- "typescript": "^5.9.3",
44
- "typescript-eslint": "^8.46.1"
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": {