Comparing version 2.8.3 to 2.8.4
{ | ||
"name": "tty-table", | ||
"version": "2.8.3", | ||
"description": "Command line table generator.", | ||
"version": "2.8.4", | ||
"description": "Node cli table", | ||
"main": "src/main.js", | ||
@@ -12,11 +12,13 @@ "engines": { | ||
}, | ||
"files": ["adapters/", "src/", "LICENSE.txt"], | ||
"preferGlobal": false, | ||
"scripts": { | ||
"dist": "npx grunt", | ||
"test": "npx grunt t", | ||
"coverage": "npx nyc mocha", | ||
"test": "npx mocha", | ||
"test-save": "npx grunt st", | ||
"lint": "./node_modules/.bin/eslint adapters/* src/*", | ||
"lint-fix": "./node_modules/.bin/eslint adapters/* src/* --fix", | ||
"lint-examples": "./node_modules/.bin/eslint adapters/* examples/*", | ||
"lint-examples-fix": "./node_modules/.bin/eslint adapters/* examples/* --fix" | ||
"lint": "npx eslint adapters/* src/*", | ||
"lint-fix": "npx eslint adapters/* src/* --fix", | ||
"lint-examples": "npx eslint adapters/* examples/*", | ||
"lint-examples-fix": "npx eslint adapters/* examples/* --fix" | ||
}, | ||
@@ -59,2 +61,3 @@ "repository": { | ||
"chai": "^4.2.0", | ||
"doctoc": "^1.4.0", | ||
"eslint": "^6.6.0", | ||
@@ -67,9 +70,8 @@ "glob": "^7.1.4", | ||
"grunt-jsdoc": "^2.4.0", | ||
"grunt-mocha-redux": "^1.1.1", | ||
"grunt-mocha-test": "^0.13.3", | ||
"grunt-shell": "^3.0.1", | ||
"jsdoc-to-markdown": "^5.0.0", | ||
"mocha": "^6.1.4", | ||
"nyc": "^15.0.0", | ||
"orgy": "^2.2.1" | ||
} | ||
} |
@@ -11,2 +11,26 @@ # tty-table 电传打字台 | ||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
**Table of Contents** | ||
- [tty-table 电传打字台](#tty-table-%E7%94%B5%E4%BC%A0%E6%89%93%E5%AD%97%E5%8F%B0) | ||
- [Examples](#examples) | ||
- [Terminal (Static)](#terminal-static) | ||
- [Terminal (Streaming)](#terminal-streaming) | ||
- [Browser & Browser Console](#browser--browser-console) | ||
- [API Reference](#api-reference) | ||
- [Table(header ```array```, rows ```array```, options ```object```)](#tableheader-array-rows-array-options-object) | ||
- [header <code>array of objects</code>](#header-codearray-of-objectscode) | ||
- [rows <code>array</code>](#rows-codearraycode) | ||
- [options <code>object</code>](#options-codeobjectcode) | ||
- [Table.render() ⇒ <code>String</code>](#tablerender-%E2%87%92-codestringcode) | ||
- [Installation](#installation) | ||
- [Running tests](#running-tests) | ||
- [Saving the output of new unit tests](#saving-the-output-of-new-unit-tests) | ||
- [Dev Tips](#dev-tips) | ||
- [Packaging as a distributable](#packaging-as-a-distributable) | ||
- [License](#license) | ||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
## [Examples](examples/) | ||
@@ -79,3 +103,3 @@ | ||
| footerColor | <code>string</code> | default: terminal default color | | ||
| formatter | <code>function(cellValue, columnIndex, rowIndex, rowData,inputData)</code> | Runs a callback on each cell value in the parent column | | ||
| formatter | <code>function(cellValue, columnIndex, rowIndex, rowData, inputData)</code> | Runs a callback on each cell value in the parent column | | ||
| headerAlign | <code>string</code> | default: "center" | | ||
@@ -82,0 +106,0 @@ | headerColor | <code>string</code> | default: terminal's default color | |
@@ -15,3 +15,3 @@ const Defaults = require("./defaults.js") | ||
* @param {string} header.column.footerColor - default: terminal default color | ||
* @param {function} header.column.formatter - Runs a callback on each cell value in the parent column | ||
* @param {function(cellValue, columnIndex, rowIndex, rowData, inputData)</code} header.column.formatter - Runs a callback on each cell value in the parent column | ||
* @param {string} header.column.headerAlign - default: "center" | ||
@@ -18,0 +18,0 @@ * @param {string} header.column.headerColor - default: terminal's default color |
@@ -235,2 +235,5 @@ const Style = require("./style.js") | ||
break | ||
case(typeof cell === "function"): | ||
cellValue = cell(cellValue,columnIndex,rowIndex,rowData,inputData) | ||
break | ||
default: | ||
@@ -241,3 +244,3 @@ //cell is assumed to be a scalar | ||
//run formatter | ||
//run header formatter | ||
if(typeof cellOptions.formatter === "function") { | ||
@@ -320,3 +323,3 @@ cellValue = cellOptions.formatter(cellValue,columnIndex,rowIndex,rowData,inputData) | ||
case("automattic-cross"): | ||
//assign header styles to first column | ||
//assign header styles to first column | ||
config.columnSettings[0] = config.columnSettings[0] || {} | ||
@@ -333,3 +336,3 @@ config.columnSettings[0].color = config.headerColor | ||
case("automattic-vertical"): | ||
//assign header styles to first column | ||
//assign header styles to first column | ||
config.columnSettings[0] = config.columnSettings[0] || {} | ||
@@ -344,8 +347,17 @@ config.columnSettings[0].color = config.headerColor | ||
case("o-horizontal"): | ||
output = rows.map(function(row) { | ||
//requires that column names are specified in header | ||
return config.table.header[0].map(function(object) { | ||
return row[object.value] || null | ||
//cell property names are specified in header columns | ||
if (config.table.header[0].length | ||
&& config.table.header[0].every( obj => obj.value )) { | ||
output = rows.map(function(row) { | ||
return config.table.header[0].map(function(object) { | ||
return row[object.value] | ||
}) | ||
}) | ||
}) | ||
} //eslint-disable-line brace-style | ||
//no property names given, default to object property order | ||
else { | ||
output = rows.map(function(obj) { | ||
return Object.values(obj) | ||
}) | ||
} | ||
break | ||
@@ -352,0 +364,0 @@ case("a-horizontal"): |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
276
3
1
43486
12
1000