console-table-printer 2.8.2 → 2.11.0

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.
package/README.md CHANGED
@@ -89,14 +89,20 @@ You can also put properties based on columns (color/alignment/title)
89
89
  ```javascript
90
90
  const p = new Table({
91
91
  columns: [
92
- { name: 'index', alignment: 'left', color: 'blue' }, //with alignment and color
92
+ { name: 'index', alignment: 'left', color: 'blue' }, // with alignment and color
93
93
  { name: 'text', alignment: 'right' },
94
94
  { name: 'is_priority_today', title: 'Is This Priority?' }, // with Title as separate Text
95
95
  ],
96
+ colorMap: {
97
+ custom_green: '\x1b[32m', // define customized color
98
+ },
96
99
  });
97
100
 
98
101
  p.addRow({ index: 1, text: 'red wine', value: 10.212 }, { color: 'green' });
99
- p.addRow({ index: 2, text: 'green gemuse', value: 20.0 });
102
+ p.addRow(
103
+ { index: 2, text: 'green gemuse', value: 20.0 },
104
+ { color: 'custom_green' } // your green
105
+ );
100
106
  p.addRow(
101
107
  { index: 3, text: 'gelb bananen', value: 100, is_priority_today: 'Y' },
102
108
  { color: 'yellow' }
@@ -108,7 +114,7 @@ p.addRow(
108
114
  p.printTable();
109
115
  ```
110
116
 
111
- ![Screenshot](https://cdn.jsdelivr.net/gh/ayonious/console-table-printer@master/static-resources/screenshot-column-props.png)
117
+ ![Screenshot](https://cdn.jsdelivr.net/gh/ayonious/console-table-printer@master/static-resources/screenshot-column-props-2.png)
112
118
 
113
119
  ## CLI
114
120
 
@@ -136,6 +142,7 @@ new Table({
136
142
  { name: 'column2', alignment: 'right', maxLen: 30 }, // lines bigger than this will be splitted in multiple lines
137
143
  { name: 'column3', title: 'Column3' }, // Title is what will be shown while printing, by default title = name
138
144
  ],
145
+ rows: [{ column1: 'row1' }, { column2: 'row2' }, { column3: 'row3' }],
139
146
  sort: (row1, row2) => row2.column1 - row1.column1, // sorting order of rows (optional), this is normal js sort function for Array.sort
140
147
  filter: (row) => row.column1 < 3, // filtering rows (optional)
141
148
  enabledColumns: ['column1'], // array of columns that you want to see, all other will be ignored (optional)
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import Table from './src/console-table-printer';
2
- import { printSimpleTable as printTable } from './src/internalTable/internal-table-printer';
2
+ import { printSimpleTable as printTable, renderSimpleTable as renderTable } from './src/internalTable/internal-table-printer';
3
3
  import { COLOR, ALIGNMENT } from './src/models/external-table';
4
- export { Table, printTable, COLOR, ALIGNMENT };
4
+ export { Table, printTable, renderTable, COLOR, ALIGNMENT };
package/dist/index.js CHANGED
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.printTable = exports.Table = void 0;
6
+ exports.renderTable = exports.printTable = exports.Table = void 0;
7
7
  const console_table_printer_1 = __importDefault(require("./src/console-table-printer"));
8
8
  exports.Table = console_table_printer_1.default;
9
9
  const internal_table_printer_1 = require("./src/internalTable/internal-table-printer");
10
10
  Object.defineProperty(exports, "printTable", { enumerable: true, get: function () { return internal_table_printer_1.printSimpleTable; } });
11
+ Object.defineProperty(exports, "renderTable", { enumerable: true, get: function () { return internal_table_printer_1.renderSimpleTable; } });
@@ -5,10 +5,10 @@ import { RowOptionsRaw } from './utils/table-helpers';
5
5
  export default class Table {
6
6
  table: TableInternal;
7
7
  constructor(options?: ComplexOptions | string[]);
8
- addColumn(column: string): void;
9
- addColumns(columns: string[]): void;
10
- addRow(text: Dictionary, rowOptions?: RowOptionsRaw): void;
11
- addRows(toBeInsertedRows: any, rowOptions?: RowOptionsRaw): void;
8
+ addColumn(column: string): this;
9
+ addColumns(columns: string[]): this;
10
+ addRow(text: Dictionary, rowOptions?: RowOptionsRaw): this;
11
+ addRows(toBeInsertedRows: any, rowOptions?: RowOptionsRaw): this;
12
12
  printTable(): void;
13
13
  render(): string;
14
14
  }
@@ -11,15 +11,19 @@ class Table {
11
11
  }
12
12
  addColumn(column) {
13
13
  this.table.addColumn(column);
14
+ return this;
14
15
  }
15
16
  addColumns(columns) {
16
17
  this.table.addColumns(columns);
18
+ return this;
17
19
  }
18
20
  addRow(text, rowOptions) {
19
- this.table.addRow(text, table_helpers_1.convertRawRowOptionsToStandard(rowOptions));
21
+ this.table.addRow(text, (0, table_helpers_1.convertRawRowOptionsToStandard)(rowOptions));
22
+ return this;
20
23
  }
21
24
  addRows(toBeInsertedRows, rowOptions) {
22
- this.table.addRows(toBeInsertedRows, table_helpers_1.convertRawRowOptionsToStandard(rowOptions));
25
+ this.table.addRows(toBeInsertedRows, (0, table_helpers_1.convertRawRowOptionsToStandard)(rowOptions));
26
+ return this;
23
27
  }
24
28
  printTable() {
25
29
  const tableRendered = this.table.renderTable();
@@ -11,5 +11,5 @@ const objIfExists = (key, val) => {
11
11
  };
12
12
  };
13
13
  exports.objIfExists = objIfExists;
14
- const rawColumnToInternalColumn = (column) => (Object.assign(Object.assign(Object.assign({ name: column.name, title: column.title || column.name }, exports.objIfExists('color', column.color)), exports.objIfExists('maxLen', column.maxLen)), { alignment: column.alignment || table_constants_1.defaultRowAlignment }));
14
+ const rawColumnToInternalColumn = (column) => (Object.assign(Object.assign(Object.assign(Object.assign({ name: column.name, title: column.title || column.name }, (0, exports.objIfExists)('color', column.color)), (0, exports.objIfExists)('maxLen', column.maxLen)), (0, exports.objIfExists)('minLen', column.minLen)), { alignment: column.alignment || table_constants_1.DEFAULT_ROW_ALIGNMENT }));
15
15
  exports.rawColumnToInternalColumn = rawColumnToInternalColumn;
@@ -11,29 +11,29 @@ const table_helpers_1 = require("../utils/table-helpers");
11
11
  const internal_table_1 = __importDefault(require("./internal-table"));
12
12
  const table_pre_processors_1 = require("./table-pre-processors");
13
13
  // ║ Index ║ ║ ║
14
- const renderOneLine = (tableStyle, columns, currentLineIndex, widthLimitedColumnsArray, isHeader, row) => {
15
- const line = new colored_console_line_1.default();
16
- line.addCharsWithColor(table_constants_1.defaultRowFontColor, tableStyle.vertical);
14
+ const renderOneLine = (tableStyle, columns, currentLineIndex, widthLimitedColumnsArray, isHeader, row, colorMap) => {
15
+ const line = new colored_console_line_1.default(colorMap);
16
+ line.addCharsWithColor(table_constants_1.DEFAULT_ROW_FONT_COLOR, tableStyle.vertical);
17
17
  columns.forEach((column) => {
18
18
  const thisLineHasText = currentLineIndex < widthLimitedColumnsArray[column.name].length;
19
19
  const textForThisLine = thisLineHasText
20
- ? table_helpers_1.cellText(widthLimitedColumnsArray[column.name][currentLineIndex])
20
+ ? (0, table_helpers_1.cellText)(widthLimitedColumnsArray[column.name][currentLineIndex])
21
21
  : '';
22
- line.addCharsWithColor(table_constants_1.defaultRowFontColor, ' ');
23
- line.addCharsWithColor((isHeader && table_constants_1.defaultHeaderFontColor) || column.color || row.color, string_utils_1.textWithPadding(textForThisLine, column.alignment || table_constants_1.defaultRowAlignment, column.maxLen || 20));
24
- line.addCharsWithColor(table_constants_1.defaultRowFontColor, ` ${tableStyle.vertical}`);
22
+ line.addCharsWithColor(table_constants_1.DEFAULT_ROW_FONT_COLOR, ' ');
23
+ line.addCharsWithColor((isHeader && table_constants_1.DEFAULT_HEADER_FONT_COLOR) || column.color || row.color, (0, string_utils_1.textWithPadding)(textForThisLine, column.alignment || table_constants_1.DEFAULT_ROW_ALIGNMENT, column.length || table_constants_1.DEFAULT_COLUMN_LEN));
24
+ line.addCharsWithColor(table_constants_1.DEFAULT_ROW_FONT_COLOR, ` ${tableStyle.vertical}`);
25
25
  });
26
26
  return line.renderConsole();
27
27
  };
28
28
  // ║ Bold ║ text ║ value ║
29
29
  // ║ Index ║ ║ ║
30
- const renderWidthLimitedLines = (tableStyle, columns, row, isHeader) => {
30
+ const renderWidthLimitedLines = (tableStyle, columns, row, colorMap, isHeader) => {
31
31
  // { col1: ['How', 'Is', 'Going'], col2: ['I am', 'Tom'], }
32
- const widthLimitedColumnsArray = table_helpers_1.getWidthLimitedColumnsArray(columns, row);
32
+ const widthLimitedColumnsArray = (0, table_helpers_1.getWidthLimitedColumnsArray)(columns, row);
33
33
  const totalLines = Object.values(widthLimitedColumnsArray).reduce((a, b) => Math.max(a, b.length), 0);
34
34
  const ret = [];
35
35
  for (let currentLineIndex = 0; currentLineIndex < totalLines; currentLineIndex += 1) {
36
- const singleLine = renderOneLine(tableStyle, columns, currentLineIndex, widthLimitedColumnsArray, isHeader, row);
36
+ const singleLine = renderOneLine(tableStyle, columns, currentLineIndex, widthLimitedColumnsArray, isHeader, row, colorMap);
37
37
  ret.push(singleLine);
38
38
  }
39
39
  return ret;
@@ -41,7 +41,7 @@ const renderWidthLimitedLines = (tableStyle, columns, row, isHeader) => {
41
41
  // ║ 1 ║ I would like some red wine please ║ 10.212 ║
42
42
  const renderRow = (table, row) => {
43
43
  let ret = [];
44
- ret = ret.concat(renderWidthLimitedLines(table.tableStyle, table.columns, row));
44
+ ret = ret.concat(renderWidthLimitedLines(table.tableStyle, table.columns, row, table.colorMap));
45
45
  return ret;
46
46
  };
47
47
  /*
@@ -57,11 +57,13 @@ const renderTableTitle = (table) => {
57
57
  const reducer = (accumulator, currentValue) =>
58
58
  // ║ cell ║, 2 spaces + cellTextSize + one border on the left
59
59
  accumulator + currentValue + 2 + 1;
60
- return table.columns.map((m) => m.maxLen || 20).reduce(reducer, 1);
60
+ return table.columns
61
+ .map((m) => m.length || table_constants_1.DEFAULT_COLUMN_LEN)
62
+ .reduce(reducer, 1);
61
63
  };
62
- const titleWithPadding = string_utils_1.textWithPadding(table.title, table_constants_1.defaultHeaderAlignment, getTableWidth());
63
- const styledText = new colored_console_line_1.default();
64
- styledText.addCharsWithColor(table_constants_1.defaultHeaderFontColor, titleWithPadding);
64
+ const titleWithPadding = (0, string_utils_1.textWithPadding)(table.title, table_constants_1.DEFAULT_HEADER_ALIGNMENT, getTableWidth());
65
+ const styledText = new colored_console_line_1.default(table.colorMap);
66
+ styledText.addCharsWithColor(table_constants_1.DEFAULT_HEADER_FONT_COLOR, titleWithPadding);
65
67
  // The analysis Result
66
68
  ret.push(styledText.renderConsole());
67
69
  return ret;
@@ -74,28 +76,39 @@ const renderTableTitle = (table) => {
74
76
  const renderTableHeaders = (table) => {
75
77
  let ret = [];
76
78
  // ╔═══════╦═══════════════════════════════════════╦════════╗
77
- ret.push(table_helpers_1.renderTableHorizontalBorders(table.tableStyle.headerTop, table.columns.map((m) => m.maxLen || 20)));
79
+ ret.push((0, table_helpers_1.renderTableHorizontalBorders)(table.tableStyle.headerTop, table.columns.map((m) => m.length || table_constants_1.DEFAULT_COLUMN_LEN)));
78
80
  // ║ index ║ text ║ value ║
79
- const row = table_helpers_1.createHeaderAsRow(table_helpers_1.createRow, table.columns);
80
- ret = ret.concat(renderWidthLimitedLines(table.tableStyle, table.columns, row, true));
81
+ const row = (0, table_helpers_1.createHeaderAsRow)(table_helpers_1.createRow, table.columns);
82
+ ret = ret.concat(renderWidthLimitedLines(table.tableStyle, table.columns, row, table.colorMap, true));
81
83
  // ╟═══════╬═══════════════════════════════════════╬════════╢
82
- ret.push(table_helpers_1.renderTableHorizontalBorders(table.tableStyle.headerBottom, table.columns.map((m) => m.maxLen || 20)));
84
+ ret.push((0, table_helpers_1.renderTableHorizontalBorders)(table.tableStyle.headerBottom, table.columns.map((m) => m.length || table_constants_1.DEFAULT_COLUMN_LEN)));
83
85
  return ret;
84
86
  };
85
87
  const renderTableEnding = (table) => {
86
88
  const ret = [];
87
89
  // ╚═══════╩═══════════════════════════════════════╩════════╝
88
- ret.push(table_helpers_1.renderTableHorizontalBorders(table.tableStyle.tableBottom, table.columns.map((m) => m.maxLen || 20)));
90
+ ret.push((0, table_helpers_1.renderTableHorizontalBorders)(table.tableStyle.tableBottom, table.columns.map((m) => m.length || table_constants_1.DEFAULT_COLUMN_LEN)));
91
+ return ret;
92
+ };
93
+ const renderRowSeparator = (table, row) => {
94
+ const ret = [];
95
+ const lastRowIndex = table.rows.length - 1;
96
+ const currentRowIndex = table.rows.indexOf(row);
97
+ if (currentRowIndex !== lastRowIndex && row.separator) {
98
+ // ╟═══════╬═══════════════════════════════════════╬════════╢
99
+ ret.push((0, table_helpers_1.renderTableHorizontalBorders)(table.tableStyle.rowSeparator, table.columns.map((m) => m.length || table_constants_1.DEFAULT_COLUMN_LEN)));
100
+ }
89
101
  return ret;
90
102
  };
91
103
  const renderTable = (table) => {
92
- table_pre_processors_1.preProcessColumns(table); // enable / disable cols, find maxLn of each col/ computed Columns
93
- table_pre_processors_1.preProcessRows(table); // sort and filter
104
+ (0, table_pre_processors_1.preProcessColumns)(table); // enable / disable cols, find maxLn of each col/ computed Columns
105
+ (0, table_pre_processors_1.preProcessRows)(table); // sort and filter
94
106
  const ret = [];
95
107
  renderTableTitle(table).forEach((row) => ret.push(row));
96
108
  renderTableHeaders(table).forEach((row) => ret.push(row));
97
109
  table.rows.forEach((row) => {
98
110
  renderRow(table, row).forEach((row_) => ret.push(row_));
111
+ renderRowSeparator(table, row).forEach((row_) => ret.push(row_));
99
112
  });
100
113
  renderTableEnding(table).forEach((row) => ret.push(row));
101
114
  return ret.join('\n');
@@ -104,10 +117,10 @@ exports.renderTable = renderTable;
104
117
  const renderSimpleTable = (rows) => {
105
118
  const table = new internal_table_1.default();
106
119
  table.addRows(rows);
107
- return exports.renderTable(table);
120
+ return (0, exports.renderTable)(table);
108
121
  };
109
122
  exports.renderSimpleTable = renderSimpleTable;
110
123
  const printSimpleTable = (rows) => {
111
- console.log(exports.renderSimpleTable(rows));
124
+ console.log((0, exports.renderSimpleTable)(rows));
112
125
  };
113
126
  exports.printSimpleTable = printSimpleTable;
@@ -1,10 +1,11 @@
1
1
  import { Dictionary, Row } from '../models/common';
2
2
  import { ComplexOptions, ComputedColumn, RowFilterFunction, RowSortFunction } from '../models/external-table';
3
- import { Column, TABLE_STYLE_DETAILS } from '../models/internal-table';
3
+ import { Column, TableStyleDetails } from '../models/internal-table';
4
+ import { ColorMap } from '../utils/colored-console-line';
4
5
  import { RowOptions } from '../utils/table-helpers';
5
6
  declare class TableInternal {
6
7
  title?: string;
7
- tableStyle: TABLE_STYLE_DETAILS;
8
+ tableStyle: TableStyleDetails;
8
9
  columns: Column[];
9
10
  rows: Row[];
10
11
  filterFunction: RowFilterFunction;
@@ -12,6 +13,8 @@ declare class TableInternal {
12
13
  enabledColumns: string[];
13
14
  disabledColumns: string[];
14
15
  computedColumns: any[];
16
+ rowSeparator: boolean;
17
+ colorMap: ColorMap;
15
18
  initSimple(columns: string[]): void;
16
19
  initDetailed(options: ComplexOptions): void;
17
20
  constructor(options?: ComplexOptions | string[]);
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const colored_console_line_1 = require("../utils/colored-console-line");
3
4
  const table_constants_1 = require("../utils/table-constants");
4
5
  const table_helpers_1 = require("../utils/table-helpers");
5
6
  const input_converter_1 = require("./input-converter");
6
7
  const internal_table_printer_1 = require("./internal-table-printer");
7
- const defaultRowSortFunc = () => 0;
8
- const defaultRowFilterFunc = () => true;
8
+ const DEFAULT_ROW_SORT_FUNC = () => 0;
9
+ const DEFAULT_ROW_FILTER_FUNC = () => true;
9
10
  class TableInternal {
10
11
  constructor(options) {
11
12
  // default construction
@@ -13,11 +14,13 @@ class TableInternal {
13
14
  this.columns = [];
14
15
  this.title = undefined;
15
16
  this.tableStyle = table_constants_1.DEFAULT_TABLE_STYLE;
16
- this.filterFunction = defaultRowFilterFunc;
17
- this.sortFunction = defaultRowSortFunc;
17
+ this.filterFunction = DEFAULT_ROW_FILTER_FUNC;
18
+ this.sortFunction = DEFAULT_ROW_SORT_FUNC;
18
19
  this.enabledColumns = [];
19
20
  this.disabledColumns = [];
20
21
  this.computedColumns = [];
22
+ this.rowSeparator = table_constants_1.DEFAULT_ROW_SEPARATOR;
23
+ this.colorMap = colored_console_line_1.DEFAULT_COLOR_MAP;
21
24
  if (options instanceof Array) {
22
25
  this.initSimple(options);
23
26
  }
@@ -29,34 +32,42 @@ class TableInternal {
29
32
  this.columns = columns.map((column) => ({
30
33
  name: column,
31
34
  title: column,
32
- alignment: table_constants_1.defaultRowAlignment,
35
+ alignment: table_constants_1.DEFAULT_ROW_ALIGNMENT,
33
36
  }));
34
37
  }
35
38
  initDetailed(options) {
36
39
  var _a;
37
- this.title = options.title || undefined;
38
- this.tableStyle = (options === null || options === void 0 ? void 0 : options.style) || table_constants_1.DEFAULT_TABLE_STYLE;
39
- this.sortFunction = (options === null || options === void 0 ? void 0 : options.sort) || defaultRowSortFunc;
40
- this.filterFunction = (options === null || options === void 0 ? void 0 : options.filter) || defaultRowFilterFunc;
41
- this.enabledColumns = (options === null || options === void 0 ? void 0 : options.enabledColumns) || [];
42
- this.disabledColumns = (options === null || options === void 0 ? void 0 : options.disabledColumns) || [];
43
- this.computedColumns = (options === null || options === void 0 ? void 0 : options.computedColumns) || [];
44
- this.columns = ((_a = options.columns) === null || _a === void 0 ? void 0 : _a.map(input_converter_1.rawColumnToInternalColumn)) || [];
40
+ this.title = (options === null || options === void 0 ? void 0 : options.title) || this.title;
41
+ this.tableStyle = (options === null || options === void 0 ? void 0 : options.style) || this.tableStyle;
42
+ this.sortFunction = (options === null || options === void 0 ? void 0 : options.sort) || this.sortFunction;
43
+ this.filterFunction = (options === null || options === void 0 ? void 0 : options.filter) || this.filterFunction;
44
+ this.enabledColumns = (options === null || options === void 0 ? void 0 : options.enabledColumns) || this.enabledColumns;
45
+ this.disabledColumns = (options === null || options === void 0 ? void 0 : options.disabledColumns) || this.disabledColumns;
46
+ this.computedColumns = (options === null || options === void 0 ? void 0 : options.computedColumns) || this.computedColumns;
47
+ this.columns =
48
+ ((_a = options === null || options === void 0 ? void 0 : options.columns) === null || _a === void 0 ? void 0 : _a.map(input_converter_1.rawColumnToInternalColumn)) || this.columns;
49
+ this.rowSeparator = (options === null || options === void 0 ? void 0 : options.rowSeparator) || this.rowSeparator;
50
+ if (options === null || options === void 0 ? void 0 : options.colorMap) {
51
+ this.colorMap = Object.assign(Object.assign({}, this.colorMap), options.colorMap);
52
+ }
53
+ if (options.rows !== undefined) {
54
+ this.addRows(options.rows);
55
+ }
45
56
  }
46
57
  createColumnFromRow(text) {
47
58
  const colNames = this.columns.map((col) => col.name);
48
59
  Object.keys(text).forEach((key) => {
49
60
  if (!colNames.includes(key)) {
50
- this.columns.push(table_helpers_1.createColumFromOnlyName(key));
61
+ this.columns.push((0, table_helpers_1.createColumFromOnlyName)(key));
51
62
  }
52
63
  });
53
64
  }
54
65
  addColumn(textOrObj) {
55
66
  if (typeof textOrObj === 'string') {
56
- this.columns.push(table_helpers_1.createColumFromOnlyName(textOrObj));
67
+ this.columns.push((0, table_helpers_1.createColumFromOnlyName)(textOrObj));
57
68
  }
58
69
  else {
59
- this.columns.push(table_helpers_1.createColumFromComputedColumn(textOrObj));
70
+ this.columns.push((0, table_helpers_1.createColumFromComputedColumn)(textOrObj));
60
71
  }
61
72
  }
62
73
  addColumns(toBeInsertedColumns) {
@@ -66,7 +77,9 @@ class TableInternal {
66
77
  }
67
78
  addRow(text, options) {
68
79
  this.createColumnFromRow(text);
69
- this.rows.push(table_helpers_1.createRow((options === null || options === void 0 ? void 0 : options.color) || table_constants_1.defaultRowFontColor, text));
80
+ 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
81
+ ? options === null || options === void 0 ? void 0 : options.separator
82
+ : this.rowSeparator));
70
83
  }
71
84
  addRows(toBeInsertedRows, options) {
72
85
  toBeInsertedRows.forEach((toBeInsertedRow) => {
@@ -74,7 +87,7 @@ class TableInternal {
74
87
  });
75
88
  }
76
89
  renderTable() {
77
- return internal_table_printer_1.renderTable(this);
90
+ return (0, internal_table_printer_1.renderTable)(this);
78
91
  }
79
92
  }
80
93
  exports.default = TableInternal;
@@ -22,16 +22,16 @@ const enableColumnsIfNecessary = (table) => {
22
22
  table.columns = table.columns.filter((col) => !table.disabledColumns.includes(col.name));
23
23
  }
24
24
  };
25
- const findMaxColumnLength = (table) => {
25
+ const findColumnWidth = (table) => {
26
26
  table.columns.forEach((column) => {
27
- column.maxLen = table_helpers_1.findMaxLenOfColumn(column, table.rows);
27
+ column.length = (0, table_helpers_1.findLenOfColumn)(column, table.rows);
28
28
  });
29
29
  };
30
30
  const preProcessColumns = (table) => {
31
31
  createComputedColumnsIfNecessary(table);
32
32
  enableColumnsIfNecessary(table);
33
33
  disableColumnsIfNecessary(table);
34
- findMaxColumnLength(table);
34
+ findColumnWidth(table);
35
35
  };
36
36
  exports.preProcessColumns = preProcessColumns;
37
37
  const preProcessRows = (table) => {
@@ -1,10 +1,11 @@
1
- import { alignments, colors } from '../utils/table-constants';
2
- export declare type ALIGNMENT = typeof alignments[number];
3
- export declare type COLOR = typeof colors[number];
1
+ import { ALIGNMENTS, COLORS } from '../utils/table-constants';
2
+ export declare type ALIGNMENT = typeof ALIGNMENTS[number];
3
+ export declare type COLOR = typeof COLORS[number];
4
4
  export interface Dictionary {
5
5
  [key: string]: any;
6
6
  }
7
7
  export interface Row {
8
8
  color: COLOR;
9
+ separator: boolean;
9
10
  text: Dictionary;
10
11
  }
@@ -1,5 +1,6 @@
1
- import { ALIGNMENT, COLOR } from './common';
2
- import { TABLE_STYLE_DETAILS } from './internal-table';
1
+ import { ColorMap } from '../utils/colored-console-line';
2
+ import { ALIGNMENT, COLOR, Dictionary } from './common';
3
+ import { TableStyleDetails } from './internal-table';
3
4
  export { ALIGNMENT, COLOR };
4
5
  export interface ColumnOptionsRaw {
5
6
  name: string;
@@ -7,6 +8,7 @@ export interface ColumnOptionsRaw {
7
8
  alignment?: ALIGNMENT;
8
9
  color?: COLOR;
9
10
  maxLen?: number;
11
+ minLen?: number;
10
12
  }
11
13
  export interface ComputedColumn extends ColumnOptionsRaw {
12
14
  function: (arg0: any) => any;
@@ -14,12 +16,15 @@ export interface ComputedColumn extends ColumnOptionsRaw {
14
16
  export declare type RowSortFunction = (row1: any, row2: any) => number;
15
17
  export declare type RowFilterFunction = (row: any) => Boolean;
16
18
  export interface ComplexOptions {
17
- style?: TABLE_STYLE_DETAILS;
19
+ style?: TableStyleDetails;
18
20
  title?: string;
19
21
  columns?: ColumnOptionsRaw[];
22
+ rows?: Dictionary[];
20
23
  sort?: RowSortFunction;
21
24
  filter?: RowFilterFunction;
22
25
  enabledColumns?: string[];
23
26
  disabledColumns?: string[];
24
27
  computedColumns?: ComputedColumn[];
28
+ rowSeparator?: boolean;
29
+ colorMap?: ColorMap;
25
30
  }
@@ -4,16 +4,19 @@ export interface Column {
4
4
  title: string;
5
5
  alignment?: ALIGNMENT;
6
6
  color?: COLOR;
7
+ length?: number;
8
+ minLen?: number;
7
9
  maxLen?: number;
8
10
  }
9
- declare type TABLE_LINE_DETAILS_KEYS = 'left' | 'right' | 'mid' | 'other';
10
- export declare type TABLE_LINE_DETAILS = {
11
- [key in TABLE_LINE_DETAILS_KEYS]: string;
11
+ declare type TableLineDetailsKeys = 'left' | 'right' | 'mid' | 'other';
12
+ export declare type TableLineDetails = {
13
+ [key in TableLineDetailsKeys]: string;
12
14
  };
13
- export declare type TABLE_STYLE_DETAILS = {
14
- headerTop: TABLE_LINE_DETAILS;
15
- headerBottom: TABLE_LINE_DETAILS;
16
- tableBottom: TABLE_LINE_DETAILS;
15
+ export declare type TableStyleDetails = {
16
+ headerTop: TableLineDetails;
17
+ headerBottom: TableLineDetails;
18
+ tableBottom: TableLineDetails;
17
19
  vertical: string;
20
+ rowSeparator?: TableLineDetails;
18
21
  };
19
22
  export {};
@@ -1,8 +1,12 @@
1
1
  import { COLOR } from '../models/common';
2
- export declare const colorString: (color: COLOR, text: string) => string;
2
+ export declare type ColorMap = {
3
+ [key in COLOR]?: string;
4
+ };
5
+ export declare const DEFAULT_COLOR_MAP: ColorMap;
3
6
  export default class ColoredConsoleLine {
4
7
  text: string;
5
- constructor();
8
+ colorMap: ColorMap;
9
+ constructor(colorMap?: ColorMap);
6
10
  addCharsWithColor(color: COLOR, text: string): void;
7
11
  renderConsole(): string;
8
12
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.colorString = void 0;
4
- const COLOR_MAP = {
3
+ exports.DEFAULT_COLOR_MAP = void 0;
4
+ exports.DEFAULT_COLOR_MAP = {
5
5
  red: '\x1b[31m',
6
6
  green: '\x1b[32m',
7
7
  yellow: '\x1b[33m',
@@ -13,20 +13,17 @@ const COLOR_MAP = {
13
13
  white_bold: '\x1b[01m',
14
14
  reset: '\x1b[0m',
15
15
  };
16
- const colorString = (color, text) => {
17
- let coloredText = '';
18
- coloredText += color && COLOR_MAP[color];
19
- coloredText += text;
20
- coloredText += COLOR_MAP.reset;
21
- return coloredText;
22
- };
23
- exports.colorString = colorString;
24
16
  class ColoredConsoleLine {
25
- constructor() {
17
+ constructor(colorMap = exports.DEFAULT_COLOR_MAP) {
26
18
  this.text = '';
19
+ this.colorMap = colorMap;
27
20
  }
28
21
  addCharsWithColor(color, text) {
29
- this.text += exports.colorString(color, text);
22
+ const colorAnsi = this.colorMap[color];
23
+ this.text +=
24
+ colorAnsi !== undefined
25
+ ? `${colorAnsi}${text}${this.colorMap.reset}`
26
+ : text;
30
27
  }
31
28
  renderConsole() {
32
29
  return this.text;
@@ -4,5 +4,5 @@ const simple_wcswidth_1 = require("simple-wcswidth");
4
4
  /* eslint-disable no-control-regex */
5
5
  const colorRegex = /\x1b\[\d{1,3}m/g; // \x1b[30m \x1b[305m
6
6
  const stripAnsi = (str) => str.replace(colorRegex, '');
7
- const findWidthInConsole = (str) => simple_wcswidth_1.wcswidth(stripAnsi(str));
7
+ const findWidthInConsole = (str) => (0, simple_wcswidth_1.wcswidth)(stripAnsi(str));
8
8
  exports.default = findWidthInConsole;
@@ -1,4 +1,4 @@
1
1
  import { ALIGNMENT } from '../models/common';
2
- export declare const textWithPadding: (text: string, alignment: ALIGNMENT, mxColumnLen: number) => string;
2
+ export declare const textWithPadding: (text: string, alignment: ALIGNMENT, columnLen: number) => string;
3
3
  export declare const limitWidth: (inpStr: string, width: number) => string[];
4
4
  export declare const biggestWordInSentence: (inpStr: string) => number;
@@ -7,14 +7,15 @@ exports.biggestWordInSentence = exports.limitWidth = exports.textWithPadding = v
7
7
  const console_utils_1 = __importDefault(require("./console-utils"));
8
8
  // ("How are you?",center, 20) => " How are you? "
9
9
  // ("How are you?",right, 20) => " How are you?"
10
- const textWithPadding = (text, alignment, mxColumnLen) => {
11
- const curTextSize = console_utils_1.default(text);
10
+ const textWithPadding = (text, alignment, columnLen) => {
11
+ const curTextSize = (0, console_utils_1.default)(text);
12
12
  // alignments for center padding case
13
- const leftPadding = Math.floor((mxColumnLen - curTextSize) / 2);
14
- const rightPadding = mxColumnLen - leftPadding - curTextSize;
13
+ const leftPadding = Math.floor((columnLen - curTextSize) / 2);
14
+ const rightPadding = columnLen - leftPadding - curTextSize;
15
+ // console.log(text, columnLen, curTextSize);
15
16
  switch (alignment) {
16
17
  case 'left':
17
- return text.concat(' '.repeat(mxColumnLen - curTextSize));
18
+ return text.concat(' '.repeat(columnLen - curTextSize));
18
19
  case 'center':
19
20
  return ' '
20
21
  .repeat(leftPadding)
@@ -22,7 +23,7 @@ const textWithPadding = (text, alignment, mxColumnLen) => {
22
23
  .concat(' '.repeat(rightPadding));
23
24
  case 'right':
24
25
  default:
25
- return ' '.repeat(mxColumnLen - curTextSize).concat(text);
26
+ return ' '.repeat(columnLen - curTextSize).concat(text);
26
27
  }
27
28
  };
28
29
  exports.textWithPadding = textWithPadding;
@@ -33,7 +34,7 @@ const limitWidth = (inpStr, width) => {
33
34
  let now = [];
34
35
  let cnt = 0;
35
36
  spaceSeparatedStrings.forEach((strWithoutSpace) => {
36
- const consoleWidth = console_utils_1.default(strWithoutSpace);
37
+ const consoleWidth = (0, console_utils_1.default)(strWithoutSpace);
37
38
  if (cnt + consoleWidth <= width) {
38
39
  cnt += consoleWidth + 1; // 1 for the space
39
40
  now.push(strWithoutSpace);
@@ -49,5 +50,5 @@ const limitWidth = (inpStr, width) => {
49
50
  };
50
51
  exports.limitWidth = limitWidth;
51
52
  // ("How are you?",10) => ["How are ", "you?"]
52
- const biggestWordInSentence = (inpStr) => inpStr.split(' ').reduce((a, b) => Math.max(a, console_utils_1.default(b)), 0);
53
+ const biggestWordInSentence = (inpStr) => inpStr.split(' ').reduce((a, b) => Math.max(a, (0, console_utils_1.default)(b)), 0);
53
54
  exports.biggestWordInSentence = biggestWordInSentence;
@@ -1,9 +1,11 @@
1
1
  import { ALIGNMENT, COLOR } from '../models/common';
2
- import { TABLE_STYLE_DETAILS } from '../models/internal-table';
3
- export declare const DEFAULT_TABLE_STYLE: TABLE_STYLE_DETAILS;
4
- export declare const alignments: string[];
5
- export declare const colors: string[];
6
- export declare const defaultRowFontColor: COLOR;
7
- export declare const defaultHeaderFontColor: COLOR;
8
- export declare const defaultRowAlignment: ALIGNMENT;
9
- export declare const defaultHeaderAlignment: ALIGNMENT;
2
+ import { TableStyleDetails } from '../models/internal-table';
3
+ export declare const DEFAULT_COLUMN_LEN = 20;
4
+ export declare const DEFAULT_ROW_SEPARATOR = false;
5
+ export declare const DEFAULT_TABLE_STYLE: TableStyleDetails;
6
+ export declare const ALIGNMENTS: string[];
7
+ export declare const COLORS: string[];
8
+ export declare const DEFAULT_ROW_FONT_COLOR: COLOR;
9
+ export declare const DEFAULT_HEADER_FONT_COLOR: COLOR;
10
+ export declare const DEFAULT_ROW_ALIGNMENT: ALIGNMENT;
11
+ export declare const DEFAULT_HEADER_ALIGNMENT: ALIGNMENT;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultHeaderAlignment = exports.defaultRowAlignment = exports.defaultHeaderFontColor = exports.defaultRowFontColor = exports.colors = exports.alignments = exports.DEFAULT_TABLE_STYLE = void 0;
3
+ exports.DEFAULT_HEADER_ALIGNMENT = exports.DEFAULT_ROW_ALIGNMENT = exports.DEFAULT_HEADER_FONT_COLOR = exports.DEFAULT_ROW_FONT_COLOR = exports.COLORS = exports.ALIGNMENTS = exports.DEFAULT_TABLE_STYLE = exports.DEFAULT_ROW_SEPARATOR = exports.DEFAULT_COLUMN_LEN = void 0;
4
+ exports.DEFAULT_COLUMN_LEN = 20;
5
+ exports.DEFAULT_ROW_SEPARATOR = false;
4
6
  exports.DEFAULT_TABLE_STYLE = {
5
7
  /*
6
8
  Default Style
@@ -28,9 +30,15 @@ exports.DEFAULT_TABLE_STYLE = {
28
30
  other: '─',
29
31
  },
30
32
  vertical: '│',
33
+ rowSeparator: {
34
+ left: '├',
35
+ mid: '┼',
36
+ right: '┤',
37
+ other: '─',
38
+ },
31
39
  };
32
- exports.alignments = ['right', 'left', 'center'];
33
- exports.colors = [
40
+ exports.ALIGNMENTS = ['right', 'left', 'center'];
41
+ exports.COLORS = [
34
42
  'red',
35
43
  'green',
36
44
  'yellow',
@@ -42,7 +50,7 @@ exports.colors = [
42
50
  'white_bold',
43
51
  'reset',
44
52
  ];
45
- exports.defaultRowFontColor = 'white';
46
- exports.defaultHeaderFontColor = 'white_bold';
47
- exports.defaultRowAlignment = 'right';
48
- exports.defaultHeaderAlignment = 'center';
53
+ exports.DEFAULT_ROW_FONT_COLOR = 'white';
54
+ exports.DEFAULT_HEADER_FONT_COLOR = 'white_bold';
55
+ exports.DEFAULT_ROW_ALIGNMENT = 'right';
56
+ exports.DEFAULT_HEADER_ALIGNMENT = 'center';
@@ -3,10 +3,12 @@ import { ComputedColumn } from '../models/external-table';
3
3
  import { Column } from '../models/internal-table';
4
4
  export declare const cellText: (text: string | number) => string;
5
5
  export interface RowOptionsRaw {
6
- color: string;
6
+ color?: string;
7
+ separator?: boolean;
7
8
  }
8
9
  export interface RowOptions {
9
10
  color: COLOR;
11
+ separator: boolean;
10
12
  }
11
13
  export declare const convertRawRowOptionsToStandard: (options?: RowOptionsRaw | undefined) => RowOptions | undefined;
12
14
  export declare const createTableHorizontalBorders: ({ left, mid, right, other, }: {
@@ -17,8 +19,8 @@ export declare const createTableHorizontalBorders: ({ left, mid, right, other, }
17
19
  }, column_lengths: number[]) => string;
18
20
  export declare const createColumFromOnlyName: (name: string) => Column;
19
21
  export declare const createColumFromComputedColumn: (column: ComputedColumn) => Column;
20
- export declare const createRow: (color: COLOR, text: Dictionary) => Row;
21
- export declare const findMaxLenOfColumn: (column: Column, rows: Row[]) => number;
22
+ export declare const createRow: (color: COLOR, text: Dictionary, separator: boolean) => Row;
23
+ export declare const findLenOfColumn: (column: Column, rows: Row[]) => number;
22
24
  export declare const renderTableHorizontalBorders: (style: any, column_lengths: number[]) => string;
23
25
  export declare const createHeaderAsRow: (createRowFn: any, columns: Column[]) => Row;
24
26
  export declare const getWidthLimitedColumnsArray: (columns: Column[], row: Row) => {
@@ -3,11 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getWidthLimitedColumnsArray = exports.createHeaderAsRow = exports.renderTableHorizontalBorders = exports.findMaxLenOfColumn = exports.createRow = exports.createColumFromComputedColumn = exports.createColumFromOnlyName = exports.createTableHorizontalBorders = exports.convertRawRowOptionsToStandard = exports.cellText = void 0;
6
+ exports.getWidthLimitedColumnsArray = exports.createHeaderAsRow = exports.renderTableHorizontalBorders = exports.findLenOfColumn = exports.createRow = exports.createColumFromComputedColumn = exports.createColumFromOnlyName = exports.createTableHorizontalBorders = exports.convertRawRowOptionsToStandard = exports.cellText = void 0;
7
7
  const input_converter_1 = require("../internalTable/input-converter");
8
8
  const console_utils_1 = __importDefault(require("./console-utils"));
9
9
  const string_utils_1 = require("./string-utils");
10
10
  const table_constants_1 = require("./table-constants");
11
+ const max = (a, b) => Math.max(a, b);
11
12
  // takes any input that is given by user and converts to string
12
13
  const cellText = (text) => text === undefined || text === null ? '' : `${text}`;
13
14
  exports.cellText = cellText;
@@ -15,6 +16,7 @@ const convertRawRowOptionsToStandard = (options) => {
15
16
  if (options) {
16
17
  return {
17
18
  color: options.color,
19
+ separator: options.separator || table_constants_1.DEFAULT_ROW_SEPARATOR,
18
20
  };
19
21
  }
20
22
  return undefined;
@@ -40,37 +42,40 @@ const createColumFromOnlyName = (name) => ({
40
42
  title: name,
41
43
  });
42
44
  exports.createColumFromOnlyName = createColumFromOnlyName;
43
- const createColumFromComputedColumn = (column) => (Object.assign(Object.assign(Object.assign({ name: column.name, title: column.title || column.name }, input_converter_1.objIfExists('color', column.color)), input_converter_1.objIfExists('maxLen', column.maxLen)), { alignment: column.alignment || table_constants_1.defaultRowAlignment }));
45
+ const createColumFromComputedColumn = (column) => (Object.assign(Object.assign(Object.assign(Object.assign({ name: column.name, title: column.title || column.name }, (0, input_converter_1.objIfExists)('color', column.color)), (0, input_converter_1.objIfExists)('maxLen', column.maxLen)), (0, input_converter_1.objIfExists)('minLen', column.minLen)), { alignment: column.alignment || table_constants_1.DEFAULT_ROW_ALIGNMENT }));
44
46
  exports.createColumFromComputedColumn = createColumFromComputedColumn;
45
- const createRow = (color, text) => ({
47
+ const createRow = (color, text, separator) => ({
46
48
  color,
49
+ separator,
47
50
  text,
48
51
  });
49
52
  exports.createRow = createRow;
50
- const findMaxLenOfColumn = (column, rows) => {
53
+ const findLenOfColumn = (column, rows) => {
51
54
  const columnId = column.name;
52
55
  const columnTitle = column.title;
56
+ let length = max(0, (column === null || column === void 0 ? void 0 : column.minLen) || 0);
53
57
  if (column.maxLen) {
54
58
  // if customer input is mentioned a max width, lets see if all other can fit here
55
59
  // if others cant fit find the max word length so that at least the table can be printed
56
- const ret = Math.max(column.maxLen, string_utils_1.biggestWordInSentence(columnTitle));
57
- return rows.reduce((acc, row) => Math.max(acc, string_utils_1.biggestWordInSentence(exports.cellText(row.text[columnId]))), ret);
60
+ length = max(length, max(column.maxLen, (0, string_utils_1.biggestWordInSentence)(columnTitle)));
61
+ length = rows.reduce((acc, row) => max(acc, (0, string_utils_1.biggestWordInSentence)((0, exports.cellText)(row.text[columnId]))), length);
62
+ return length;
58
63
  }
59
- let maxLen = console_utils_1.default(columnTitle);
64
+ length = max(length, (0, console_utils_1.default)(columnTitle));
60
65
  rows.forEach((row) => {
61
- maxLen = Math.max(maxLen, console_utils_1.default(exports.cellText(row.text[columnId])));
66
+ length = max(length, (0, console_utils_1.default)((0, exports.cellText)(row.text[columnId])));
62
67
  });
63
- return maxLen;
68
+ return length;
64
69
  };
65
- exports.findMaxLenOfColumn = findMaxLenOfColumn;
70
+ exports.findLenOfColumn = findLenOfColumn;
66
71
  const renderTableHorizontalBorders = (style, column_lengths) => {
67
- const str = exports.createTableHorizontalBorders(style, column_lengths);
72
+ const str = (0, exports.createTableHorizontalBorders)(style, column_lengths);
68
73
  return str;
69
74
  };
70
75
  exports.renderTableHorizontalBorders = renderTableHorizontalBorders;
71
76
  const createHeaderAsRow = (createRowFn, columns) => {
72
- const headerColor = 'white_bold';
73
- const row = createRowFn(headerColor, {});
77
+ const headerColor = table_constants_1.DEFAULT_HEADER_FONT_COLOR;
78
+ const row = createRowFn(headerColor, {}, false);
74
79
  columns.forEach((column) => {
75
80
  row.text[column.name] = column.title;
76
81
  });
@@ -81,7 +86,7 @@ exports.createHeaderAsRow = createHeaderAsRow;
81
86
  const getWidthLimitedColumnsArray = (columns, row) => {
82
87
  const ret = {};
83
88
  columns.forEach((column) => {
84
- ret[column.name] = string_utils_1.limitWidth(exports.cellText(row.text[column.name]), column.maxLen || 20);
89
+ ret[column.name] = (0, string_utils_1.limitWidth)((0, exports.cellText)(row.text[column.name]), column.length || table_constants_1.DEFAULT_COLUMN_LEN);
85
90
  });
86
91
  return ret;
87
92
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "console-table-printer",
3
- "version": "2.8.2",
3
+ "version": "2.11.0",
4
4
  "repository": "github:ayonious/console-table-printer",
5
5
  "description": "Printing pretty tables on console log",
6
6
  "main": "dist/index.js",
@@ -25,24 +25,24 @@
25
25
  "author": "Nahiyan Kamal",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@semantic-release/changelog": "^5.0.1",
29
- "@semantic-release/git": "^9.0.0",
30
- "@types/jest": "^26.0.21",
31
- "@typescript-eslint/eslint-plugin": "^4.18.0",
32
- "@typescript-eslint/parser": "^4.18.0",
33
- "chalk": "^4.1.0",
34
- "eslint": "^7.22.0",
28
+ "@semantic-release/changelog": "^6.0.1",
29
+ "@semantic-release/git": "^10.0.1",
30
+ "@types/jest": "^27.0.2",
31
+ "@typescript-eslint/eslint-plugin": "^5.2.0",
32
+ "@typescript-eslint/parser": "^5.2.0",
33
+ "chalk": "^4.1.2",
34
+ "eslint": "^8.1.0",
35
35
  "eslint-config-airbnb-base": "^14.2.1",
36
- "eslint-config-prettier": "^8.1.0",
37
- "eslint-plugin-import": "^2.22.1",
38
- "eslint-plugin-prettier": "^3.3.1",
39
- "husky": "^5.1.3",
40
- "jest": "^26.6.3",
41
- "prettier": "^2.2.1",
42
- "pretty-quick": "^3.1.0",
43
- "semantic-release": "^17.4.2",
44
- "ts-jest": "^26.5.4",
45
- "typescript": "^4.2.3"
36
+ "eslint-config-prettier": "^8.3.0",
37
+ "eslint-plugin-import": "^2.25.2",
38
+ "eslint-plugin-prettier": "^4.0.0",
39
+ "husky": "^7.0.4",
40
+ "jest": "^27.3.1",
41
+ "prettier": "^2.4.1",
42
+ "pretty-quick": "^3.1.1",
43
+ "semantic-release": "^18.0.0",
44
+ "ts-jest": "^27.0.7",
45
+ "typescript": "^4.4.4"
46
46
  },
47
47
  "homepage": "https://console-table.netlify.app",
48
48
  "dependencies": {
package/CHANGELOG.md DELETED
@@ -1,84 +0,0 @@
1
- ## [2.8.2](https://github.com/ayonious/console-table-printer/compare/v2.8.1...v2.8.2) (2021-03-19)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * added circle ci ([79e72eb](https://github.com/ayonious/console-table-printer/commit/79e72eba75763d9c5e964a3aafc1a83a36f75b5a))
7
- * Calculated Columns Title is shown ([#349](https://github.com/ayonious/console-table-printer/issues/349)) ([88ae550](https://github.com/ayonious/console-table-printer/commit/88ae55070818e7cc06d8a0872aeb45ffd3ed0299))
8
-
9
- ## [2.8.1](https://github.com/ayonious/console-table-printer/compare/v2.8.0...v2.8.1) (2021-03-06)
10
-
11
-
12
- ### Bug Fixes
13
-
14
- * fixing deployment ([981d819](https://github.com/ayonious/console-table-printer/commit/981d819e552c60f7d1a4f9f24a83e33a97eb582c))
15
-
16
- # [2.8.0](https://github.com/ayonious/console-table-printer/compare/v2.7.5...v2.8.0) (2021-03-06)
17
-
18
-
19
- ### Features
20
-
21
- * Width Limit ([#343](https://github.com/ayonious/console-table-printer/issues/343)) ([f5a541b](https://github.com/ayonious/console-table-printer/commit/f5a541ba39d22cbe37cbbd8100b3b740b4247ba3))
22
-
23
- ## [2.7.5](https://github.com/ayonious/console-table-printer/compare/v2.7.4...v2.7.5) (2020-12-08)
24
-
25
-
26
- ### Bug Fixes
27
-
28
- * **technical:** migrate to yarn and fix deployment ([0a1babb](https://github.com/ayonious/console-table-printer/commit/0a1babb87ec404da68471517dcca9a5595a03e81))
29
-
30
- ## [2.7.4](https://github.com/ayonious/console-table-printer/compare/v2.7.3...v2.7.4) (2020-12-08)
31
-
32
-
33
- ### Bug Fixes
34
-
35
- * Asian Languages width fixing with simple-wcswidth ([a14272f](https://github.com/ayonious/console-table-printer/commit/a14272f6738310cc21492c38adf71fac06b2a9dd))
36
-
37
- ## [2.7.3](https://github.com/ayonious/console-table-printer/compare/v2.7.2...v2.7.3) (2020-12-06)
38
-
39
-
40
- ### Bug Fixes
41
-
42
- * revert wcwidth and special character support ([#329](https://github.com/ayonious/console-table-printer/issues/329)) ([d6e7847](https://github.com/ayonious/console-table-printer/commit/d6e78475f10fac718c2848483ac88611bd804b01))
43
-
44
- ## [2.7.2](https://github.com/ayonious/console-table-printer/compare/v2.7.1...v2.7.2) (2020-12-06)
45
-
46
-
47
- ### Bug Fixes
48
-
49
- * column width calculation with special characters ([#303](https://github.com/ayonious/console-table-printer/issues/303)) ([5a288e7](https://github.com/ayonious/console-table-printer/commit/5a288e7e4e5ee3daa9a3da7befc450fea3adbea1))
50
-
51
- ## [2.7.1](https://github.com/ayonious/console-table-printer/compare/v2.7.0...v2.7.1) (2020-12-05)
52
-
53
-
54
- ### Bug Fixes
55
-
56
- * **docs:** readme update for Header title ([#321](https://github.com/ayonious/console-table-printer/issues/321)) ([572979f](https://github.com/ayonious/console-table-printer/commit/572979f7d5d8b9f83a69bc51020cbaebd83a3f93))
57
-
58
- # [2.7.0](https://github.com/ayonious/console-table-printer/compare/v2.6.0...v2.7.0) (2020-12-05)
59
-
60
-
61
- ### Features
62
-
63
- * Header title - View Header Title in console instead of ugly header name ([#319](https://github.com/ayonious/console-table-printer/issues/319)) ([78bb5aa](https://github.com/ayonious/console-table-printer/commit/78bb5aa6a6cb76d09c63f115f37cb9f4ad02e315))
64
-
65
- # [2.6.0](https://github.com/ayonious/console-table-printer/compare/v2.5.1...v2.6.0) (2020-12-04)
66
-
67
-
68
- ### Features
69
-
70
- * Allow cell coloring ([#317](https://github.com/ayonious/console-table-printer/issues/317)) ([1026d51](https://github.com/ayonious/console-table-printer/commit/1026d5136240228b6e44d29afee45f1a6350ad07))
71
-
72
- ## [2.5.1](https://github.com/ayonious/console-table-printer/compare/v2.5.0...v2.5.1) (2020-11-07)
73
-
74
-
75
- ### Bug Fixes
76
-
77
- * **technical:** update dependency eslint to ^7.13.0 and remove package-lock deps updates ([#290](https://github.com/ayonious/console-table-printer/issues/290)) ([adc9c05](https://github.com/ayonious/console-table-printer/commit/adc9c052311e4b1508d17edfb2c0a92c65577e99))
78
-
79
- # [2.5.0](https://github.com/ayonious/console-table-printer/compare/v2.4.36...v2.5.0) (2020-11-04)
80
-
81
-
82
- ### Features
83
-
84
- * **technical:** semantic release ([#288](https://github.com/ayonious/console-table-printer/issues/288)) ([3121382](https://github.com/ayonious/console-table-printer/commit/31213829a2b8e1e6f6aa9ee0b34e6a0450816952))