console-table-printer 2.15.3 → 2.16.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
@@ -159,6 +159,7 @@ new Table({
159
159
 
160
160
  - `addRow(rowObjet, options)` adding single row. This can be chained
161
161
  - `addRows(rowObjects, options)` adding multiple rows. array of row object. This case options will be applied to all the objects in row
162
+ - `clearRows()` removes all rows while keeping the table columns and options. This can be chained
162
163
  - `addColumn(columnObject)` adding single column
163
164
  - `addColumns(columnObjects)` adding multiple columns
164
165
  - `printTable()` Prints the table on your console
@@ -9,6 +9,7 @@ export default class Table {
9
9
  addColumns(columns: string[] | ColumnOptionsRaw[]): this;
10
10
  addRow(text: Dictionary, rowOptions?: RowOptionsRaw): this;
11
11
  addRows(toBeInsertedRows: Dictionary[], rowOptions?: RowOptionsRaw): this;
12
+ clearRows(): this;
12
13
  printTable(): void;
13
14
  render(): string;
14
15
  }
@@ -25,6 +25,10 @@ class Table {
25
25
  this.table.addRows(toBeInsertedRows, (0, table_helpers_1.convertRawRowOptionsToStandard)(rowOptions));
26
26
  return this;
27
27
  }
28
+ clearRows() {
29
+ this.table.clearRows();
30
+ return this;
31
+ }
28
32
  printTable() {
29
33
  const tableRendered = this.table.renderTable();
30
34
  console.log(tableRendered);
@@ -26,6 +26,7 @@ declare class TableInternal {
26
26
  addColumns(toBeInsertedColumns: string[] | ColumnOptionsRaw[]): void;
27
27
  addRow(text: Dictionary, options?: RowOptions): void;
28
28
  addRows(toBeInsertedRows: Dictionary[], options?: RowOptions): void;
29
+ clearRows(): void;
29
30
  renderTable(): string;
30
31
  }
31
32
  export default TableInternal;
@@ -91,6 +91,9 @@ class TableInternal {
91
91
  this.addRow(toBeInsertedRow, options);
92
92
  });
93
93
  }
94
+ clearRows() {
95
+ this.rows = [];
96
+ }
94
97
  renderTable() {
95
98
  return (0, internal_table_printer_1.renderTable)(this);
96
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "console-table-printer",
3
- "version": "2.15.3",
3
+ "version": "2.16.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/console-table-printer/console-table-printer.git"