๐Ÿš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more โ†’
Socket
Book a DemoInstallSign in
Socket

table

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

table - npm Package Compare versions

Comparing version

to
3.2.0

.README/usage/draw_join.md

13

.README/usage.md

@@ -53,5 +53,16 @@ ## Usage

/**
* Used to dynamically tell table whether to draw a line separating rows or not.
* The default behavior is to always return true.
*
* @typedef {function} drawJoin
* @param {number} index
* @param {number} size
* @return {boolean}
*/
/**
* @typedef {Object} table~config
* @property {table~border} border
* @property {table~columns[]} columns Column specific configuration.
* @property {table~drawJoin} drawJoin
*/

@@ -63,3 +74,3 @@

* @param {table~row[]} rows
* @param {table~config} userConfig
* @param {table~config} config
* @return {String}

@@ -66,0 +77,0 @@ */

2

.README/usage/cell_content_alignment.md
### Cell Content Alignment
`config.columns[{number}].alignment` property controls content horizontal alignment within a cell.
`{string} config.columns[{number}].alignment` property controls content horizontal alignment within a cell.

@@ -5,0 +5,0 @@ Valid values are: "left", "right" and "center".

### Column Width
`config.columns[{number}].width` property restrictions column width to a fixed width.
`{number} config.columns[{number}].width` property restricts column width to a fixed width.

@@ -5,0 +5,0 @@ ```js

### Custom Border
`config.border` property describes characters used to draw the table border.
`{object} config.border` property describes characters used to draw the table border.

@@ -5,0 +5,0 @@ ```js

### Padding Cell Content
`config.columns[{number}].paddingLeft` and `config.columns[{number}].paddingRight` properties control content padding within a cell. Property value represents a number of whitespaces used to pad the content.
`{number} config.columns[{number}].paddingLeft` and `{number} config.columns[{number}].paddingRight` properties control content padding within a cell. Property value represents a number of whitespaces used to pad the content.

@@ -5,0 +5,0 @@ ```js

@@ -23,5 +23,6 @@ 'use strict';

* @param {Array} rowSpanIndex
* @param {function} drawJoin
*/
exports['default'] = function (rows, border, columnSizeIndex, rowSpanIndex) {
exports['default'] = function (rows, border, columnSizeIndex, rowSpanIndex, drawJoin) {
var output = undefined,

@@ -50,3 +51,3 @@ rowCount = undefined,

if (rowHeight === 0 && i !== rowCount - 1) {
if (rowHeight === 0 && i !== rowCount - 1 && drawJoin(realRowIndex, rowCount)) {
output += (0, _drawBorder.drawBorderJoin)(columnSizeIndex, border);

@@ -53,0 +54,0 @@ }

@@ -32,3 +32,3 @@ 'use strict';

* @param {Object} border
* @return {Object}
* @returns {Object}
*/

@@ -47,3 +47,3 @@ makeBorder = function () {

* @param {Object} columns
* @return {Object}
* @returns {Object}
*/

@@ -88,3 +88,3 @@ makeColumns = function (rows) {

* @param {Object} userConfig
* @return {Object}
* @returns {Object}
*/

@@ -104,2 +104,11 @@

if (!config.drawJoin) {
/**
* @returns {boolean}
*/
config.drawJoin = function () {
return true;
};
}
return config;

@@ -106,0 +115,0 @@ };

@@ -9,2 +9,5 @@ {

"$ref": "#/definitions/columns"
},
"drawJoin": {
"type": "function"
}

@@ -11,0 +14,0 @@ },

@@ -89,5 +89,16 @@ 'use strict';

/**
* Used to dynamically tell table whether to draw a line separating rows or not.
* The default behavior is to always return true.
*
* @typedef {function} drawJoin
* @param {number} index
* @param {number} size
* @return {boolean}
*/
/**
* @typedef {Object} table~config
* @property {table~border} border
* @property {table~columns[]} columns Column specific configuration.
* @property {table~drawJoin} drawJoin
*/

@@ -125,3 +136,3 @@

return (0, _drawTable2['default'])(rows, config.border, cellWidthIndex, rowHeightIndex);
return (0, _drawTable2['default'])(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawJoin);
};

@@ -128,0 +139,0 @@

{
"name": "table",
"version": "3.1.0",
"version": "3.2.0",
"description": "Formats data into a string table.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -92,3 +92,3 @@ <h1 id="table">Table</h1>

* @param {table~row[]} rows
* @param {table~config} userConfig
* @param {table~config} config
* @return {String}

@@ -95,0 +95,0 @@ */

@@ -13,4 +13,5 @@ import _ from 'lodash';

* @param {Array} rowSpanIndex
* @param {function} drawJoin
*/
export default (rows, border, columnSizeIndex, rowSpanIndex) => {
export default (rows, border, columnSizeIndex, rowSpanIndex, drawJoin) => {
let output,

@@ -39,3 +40,3 @@ rowCount,

if (rowHeight === 0 && i !== rowCount - 1) {
if (rowHeight === 0 && i !== rowCount - 1 && drawJoin(realRowIndex, rowCount)) {
output += drawBorderJoin(columnSizeIndex, border);

@@ -42,0 +43,0 @@ }

@@ -13,3 +13,3 @@ import _ from 'lodash';

* @param {Object} border
* @return {Object}
* @returns {Object}
*/

@@ -26,3 +26,3 @@ makeBorder = (border = {}) => {

* @param {Object} columns
* @return {Object}
* @returns {Object}
*/

@@ -65,3 +65,3 @@ makeColumns = (rows, columns = {}) => {

* @param {Object} userConfig
* @return {Object}
* @returns {Object}
*/

@@ -78,3 +78,12 @@ export default (rows, userConfig = {}) => {

if (!config.drawJoin) {
/**
* @returns {boolean}
*/
config.drawJoin = () => {
return true;
};
}
return config;
};

@@ -9,2 +9,5 @@ {

"$ref": "#/definitions/columns"
},
"drawJoin": {
"type": "function"
}

@@ -11,0 +14,0 @@ },

@@ -49,5 +49,16 @@ import _ from 'lodash';

/**
* Used to dynamically tell table whether to draw a line separating rows or not.
* The default behavior is to always return true.
*
* @typedef {function} drawJoin
* @param {number} index
* @param {number} size
* @return {boolean}
*/
/**
* @typedef {Object} table~config
* @property {table~border} border
* @property {table~columns[]} columns Column specific configuration.
* @property {table~drawJoin} drawJoin
*/

@@ -82,3 +93,3 @@

return drawTable(rows, config.border, cellWidthIndex, rowHeightIndex);
return drawTable(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawJoin);
};

@@ -6,5 +6,3 @@ /* eslint-disable max-nested-callbacks */

} from 'chai';
import _ from 'lodash';
import makeConfig from './../src/makeConfig';

@@ -11,0 +9,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet