console-table-printer 2.15.2 → 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.
@@ -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) => {
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "console-table-printer",
3
- "version": "2.15.2",
3
+ "version": "2.15.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/console-table-printer/console-table-printer.git"