console-table-printer
Advanced tools
Comparing version
@@ -0,4 +1,5 @@ | ||
import { ComplexOptions } from '../models/external-table'; | ||
import TableInternal from './internal-table'; | ||
export declare const renderTable: (table: TableInternal) => string; | ||
export declare const renderSimpleTable: (rows: any[]) => string; | ||
export declare const printSimpleTable: (rows: any[]) => void; | ||
export declare const renderSimpleTable: (rows: any[], tableOptions?: ComplexOptions) => string; | ||
export declare const printSimpleTable: (rows: any[], tableOptions?: ComplexOptions) => void; |
@@ -117,4 +117,4 @@ "use strict"; | ||
exports.renderTable = renderTable; | ||
const renderSimpleTable = (rows) => { | ||
const table = new internal_table_1.default(); | ||
const renderSimpleTable = (rows, tableOptions) => { | ||
const table = new internal_table_1.default(tableOptions); | ||
table.addRows(rows); | ||
@@ -124,5 +124,5 @@ return (0, exports.renderTable)(table); | ||
exports.renderSimpleTable = renderSimpleTable; | ||
const printSimpleTable = (rows) => { | ||
console.log((0, exports.renderSimpleTable)(rows)); | ||
const printSimpleTable = (rows, tableOptions) => { | ||
console.log((0, exports.renderSimpleTable)(rows, tableOptions)); | ||
}; | ||
exports.printSimpleTable = printSimpleTable; |
@@ -8,5 +8,10 @@ "use strict"; | ||
table.computedColumns.forEach((computedColumn) => { | ||
// This can happen if renderTable/printTable is called multiple times | ||
const isColumnAlreadyExists = table.columns.some((col) => col.name === computedColumn.name); | ||
if (isColumnAlreadyExists) { | ||
return; | ||
} | ||
table.addColumn(computedColumn); | ||
table.rows.forEach((row, index, array) => { | ||
const arrayRowText = array.map(() => row.text); | ||
table.rows.forEach((row, index, rowsArray) => { | ||
const arrayRowText = rowsArray.map((elemInRowsArray) => elemInRowsArray.text); | ||
row.text[computedColumn.name] = computedColumn.function(row.text, index, arrayRowText); | ||
@@ -13,0 +18,0 @@ }); |
{ | ||
"name": "console-table-printer", | ||
"version": "2.13.0", | ||
"repository": "github:ayonious/console-table-printer", | ||
"version": "2.14.0", | ||
"repository": "github:console-table-printer/console-table-printer", | ||
"description": "Printing pretty tables on console log", | ||
@@ -42,3 +42,3 @@ "main": "dist/index.js", | ||
"pretty-quick": "^4.1.1", | ||
"semantic-release": "^24.2.4", | ||
"semantic-release": "^24.2.5", | ||
"ts-jest": "^29.3.4", | ||
@@ -45,0 +45,0 @@ "typescript": "^5.8.3" |
<h1 align="center">console-table-printer</h1> | ||
<h3 align="center">🖥️🍭Printing Pretty Tables on your console</h3> | ||
<p align="center"> | ||
<a href="https://codecov.io/gh/ayonious/console-table-printer"> | ||
<img alt="codecov" src="https://codecov.io/gh/ayonious/console-table-printer/branch/master/graph/badge.svg"> | ||
</a> | ||
<a href="https://badge.fury.io/js/console-table-printer"> | ||
<img alt="npm version" src="https://badge.fury.io/js/console-table-printer.svg"> | ||
</a> | ||
<a href="https://packagephobia.now.sh/result?p=console-table-printer"> | ||
<img alt="install size" src="https://packagephobia.now.sh/badge?p=console-table-printer@latest"> | ||
</a> | ||
</p> | ||
<p align="center"> | ||
<a href="https://github.com/prettier/prettier"> | ||
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=plastic"> | ||
</a> | ||
<a href="https://github.com/semantic-release/semantic-release"> | ||
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg"> | ||
</a> | ||
</p> | ||
> 🖥️🍭Printing Pretty Tables on your console</h3> | ||
 | ||
[](https://packagephobia.com/result?p=console-table-printer) | ||
[](https://badge.fury.io/js/console-table-printer) | ||
[](https://codecov.io/gh/console-table-printer/console-table-printer) | ||
## Synopsis | ||
@@ -48,3 +36,3 @@ | ||
 | ||
 | ||
@@ -74,3 +62,3 @@ ## 🚨🚨Announcement🚨🚨 Official Documentation is moved [Here](https://console-table.netlify.app/docs) | ||
 | ||
 | ||
@@ -87,3 +75,3 @@ You can also put some color to your table like this: | ||
 | ||
 | ||
@@ -118,3 +106,3 @@ You can also put properties based on columns (color/alignment/title) | ||
 | ||
 | ||
@@ -202,2 +190,2 @@ ## CLI | ||
[MIT](https://github.com/ayonious/console-table-printer/blob/master/LICENSE) | ||
[MIT](https://github.com/console-table-printer/console-table-printer/blob/master/LICENSE) |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
46542
0.21%822
0.74%187
-5.56%