Socket
Socket
Sign inDemoInstall

table

Package Overview
Dependencies
Maintainers
1
Versions
86
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 4.0.1 to 4.0.2

6

dist/alignString.js

@@ -68,7 +68,7 @@ 'use strict';

if (!_lodash2.default.isString(subject)) {
throw new Error('Subject parameter value must be a string.');
throw new TypeError('Subject parameter value must be a string.');
}
if (!_lodash2.default.isNumber(containerWidth)) {
throw new Error('Container width parameter value must be a number.');
throw new TypeError('Container width parameter value must be a number.');
}

@@ -85,3 +85,3 @@

if (!_lodash2.default.isString(alignment)) {
throw new Error('Alignment parameter value must be a string.');
throw new TypeError('Alignment parameter value must be a string.');
}

@@ -88,0 +88,0 @@

@@ -7,6 +7,2 @@ 'use strict';

var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _stringWidth = require('string-width');

@@ -28,4 +24,4 @@

exports.default = (rows, config) => {
return _lodash2.default.map(rows, cells => {
return _lodash2.default.map(cells, (value, index1) => {
return rows.map(cells => {
return cells.map((value, index1) => {
const column = config.columns[index1];

@@ -32,0 +28,0 @@

@@ -31,7 +31,7 @@ 'use strict';

if (!_lodash2.default.isString(value)) {
throw new Error('Value must be a string.');
throw new TypeError('Value must be a string.');
}
if (!_lodash2.default.isInteger(columnWidth)) {
throw new Error('Column width must be an integer.');
throw new TypeError('Column width must be an integer.');
}

@@ -38,0 +38,0 @@

@@ -7,6 +7,2 @@ 'use strict';

var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _stringWidth = require('string-width');

@@ -25,5 +21,5 @@

exports.default = cells => {
return _lodash2.default.map(cells, value => {
return cells.map(value => {
return (0, _stringWidth2.default)(value);
});
};

@@ -34,7 +34,7 @@ 'use strict';

if (!_lodash2.default.isNumber(config.columns[index1].width)) {
throw new Error('column[index].width must be a number.');
throw new TypeError('column[index].width must be a number.');
}
if (!_lodash2.default.isBoolean(config.columns[index1].wrapWord)) {
throw new Error('column[index].wrapWord must be a boolean.');
throw new TypeError('column[index].wrapWord must be a boolean.');
}

@@ -41,0 +41,0 @@

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

output = '\r\x1b[K';
output = '\r\u001B[K';

@@ -112,0 +112,0 @@ output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config.border);

@@ -28,3 +28,5 @@ 'use strict';

exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => {
let output, realRowIndex, rowHeight;
let output;
let realRowIndex;
let rowHeight;

@@ -31,0 +33,0 @@ const rowCount = rows.length;

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

return _lodash2.default.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border);
return Object.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border);
};

@@ -92,4 +92,4 @@

/**
* @returns {boolean}
*/
* @returns {boolean}
*/
config.drawHorizontalLine = () => {

@@ -96,0 +96,0 @@ return true;

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

return _lodash2.default.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border);
return Object.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border);
};

@@ -52,3 +52,3 @@

columns[index] = _lodash2.default.assign({
columns[index] = Object.assign({
alignment: 'left',

@@ -55,0 +55,0 @@ paddingLeft: 1,

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

const mappedRows = _lodash2.default.map(unmappedRows, (cells, index0) => {
const mappedRows = unmappedRows.map((cells, index0) => {
const rowHeight = _lodash2.default.times(rowHeightIndex[index0], () => {

@@ -33,0 +33,0 @@ return _lodash2.default.fill(Array(tableWidth), '');

{
"id": "config.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "config.json",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",

@@ -5,0 +5,0 @@ "properties": {

{
"id": "streamConfig.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "streamConfig.json",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",

@@ -5,0 +5,0 @@ "properties": {

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -7,8 +7,2 @@ Object.defineProperty(exports, "__esModule", {

var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -21,5 +15,5 @@ * Casts all cell values to a string.

exports.default = rows => {
return _lodash2.default.map(rows, cells => {
return _lodash2.default.map(cells, String);
return rows.map(cells => {
return cells.map(String);
});
};

@@ -246,3 +246,2 @@ 'use strict';

var errors = 0;
if (rootData === undefined) rootData = data;
if (typeof data !== "string") {

@@ -345,3 +344,2 @@ var err = {

var errors = 0;
if (rootData === undefined) rootData = data;
if ((data && typeof data === "object" && !Array.isArray(data))) {

@@ -371,2 +369,16 @@ var errs__0 = errors;

var errs_1 = errors;
if (typeof data1 !== "string") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.alignment',
schemaPath: '#/properties/alignment/type',
params: {
type: 'string'
},
message: 'should be string'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var schema1 = validate.schema.properties.alignment.enum;

@@ -394,16 +406,2 @@ var valid1;

}
if (typeof data1 !== "string") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.alignment',
schemaPath: '#/properties/alignment/type',
params: {
type: 'string'
},
message: 'should be string'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;

@@ -547,3 +545,3 @@ }

return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
'use strict'; /*# sourceURL=config.json */
var vErrors = null;

@@ -604,3 +602,4 @@ var errors = 0;

var valid1;
if (!(typeof data.drawHorizontalLine == "function")) {
valid1 = typeof data.drawHorizontalLine == "function";
if (!valid1) {
if (errs__1 == errors) {

@@ -622,5 +621,3 @@ var err = {

var ruleErr1 = vErrors[i1];
if (ruleErr1.dataPath === undefined) {
ruleErr1.dataPath = (dataPath || '') + '.drawHorizontalLine';
}
if (ruleErr1.dataPath === undefined) ruleErr1.dataPath = (dataPath || '') + '.drawHorizontalLine';
if (ruleErr1.schemaPath === undefined) {

@@ -653,4 +650,4 @@ ruleErr1.schemaPath = "#/properties/drawHorizontalLine/typeof";

validate.schema = {
"id": "config.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "config.json",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",

@@ -657,0 +654,0 @@ "properties": {

@@ -246,3 +246,2 @@ 'use strict';

var errors = 0;
if (rootData === undefined) rootData = data;
if (typeof data !== "string") {

@@ -345,3 +344,2 @@ var err = {

var errors = 0;
if (rootData === undefined) rootData = data;
if ((data && typeof data === "object" && !Array.isArray(data))) {

@@ -371,2 +369,16 @@ var errs__0 = errors;

var errs_1 = errors;
if (typeof data1 !== "string") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.alignment',
schemaPath: '#/properties/alignment/type',
params: {
type: 'string'
},
message: 'should be string'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var schema1 = validate.schema.properties.alignment.enum;

@@ -394,16 +406,2 @@ var valid1;

}
if (typeof data1 !== "string") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.alignment',
schemaPath: '#/properties/alignment/type',
params: {
type: 'string'
},
message: 'should be string'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;

@@ -547,3 +545,3 @@ }

return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
'use strict'; /*# sourceURL=streamConfig.json */
var vErrors = null;

@@ -637,4 +635,4 @@ var errors = 0;

validate.schema = {
"id": "streamConfig.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "streamConfig.json",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",

@@ -641,0 +639,0 @@ "properties": {

@@ -7,8 +7,2 @@ 'use strict';

var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -27,4 +21,4 @@ * @typedef {string} cell

exports.default = rows => {
if (!_lodash2.default.isArray(rows)) {
throw new Error('Table data must be an array.');
if (!Array.isArray(rows)) {
throw new TypeError('Table data must be an array.');
}

@@ -42,5 +36,5 @@

_lodash2.default.forEach(rows, cells => {
if (!_lodash2.default.isArray(cells)) {
throw new Error('Table row data must be an array.');
for (const cells of rows) {
if (!Array.isArray(cells)) {
throw new TypeError('Table row data must be an array.');
}

@@ -54,8 +48,8 @@

// @see https://github.com/gajus/table/issues/9
_lodash2.default.forEach(cells, cell => {
if (/[\x01-\x1A]/.test(cell)) {
for (const cell of cells) {
if (/[\u0001-\u001A]/.test(cell)) {
throw new Error('Table data must not contain control characters.');
}
});
});
}
}
};

@@ -8,26 +8,26 @@ {

"dependencies": {
"ajv": "^4.7.0",
"ajv-keywords": "^1.0.0",
"chalk": "^1.1.1",
"lodash": "^4.0.0",
"slice-ansi": "0.0.4",
"string-width": "^2.0.0"
"ajv": "^5.2.3",
"ajv-keywords": "^2.1.0",
"chalk": "^2.1.0",
"lodash": "^4.17.4",
"slice-ansi": "1.0.0",
"string-width": "^2.1.1"
},
"description": "Formats data into a string table.",
"devDependencies": {
"ajv-cli": "^1.1.0",
"babel": "^6.5.2",
"babel-cli": "^6.14.0",
"babel-core": "^6.14.0",
"babel-plugin-istanbul": "^2.0.3",
"babel-preset-es2015-node4": "^2.1.0",
"babel-register": "^6.14.0",
"chai": "^3.4.1",
"eslint": "^3.5.0",
"eslint-config-canonical": "^1.8.6",
"gitdown": "^2.4.0",
"husky": "^0.11.7",
"mocha": "^3.0.2",
"nyc": "^8.3.1",
"sinon": "^1.17.2"
"ajv-cli": "^2.1.0",
"babel": "^6.23.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-plugin-istanbul": "^4.1.5",
"babel-preset-es2015-node4": "^2.1.1",
"babel-register": "^6.26.0",
"chai": "^4.1.2",
"eslint": "^4.7.2",
"eslint-config-canonical": "^9.3.1",
"gitdown": "^2.5.1",
"husky": "^0.14.3",
"mocha": "^3.5.3",
"nyc": "^11.2.1",
"sinon": "^4.0.0"
},

@@ -68,3 +68,3 @@ "keywords": [

},
"version": "4.0.1"
"version": "4.0.2"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc