Initial commit

This commit is contained in:
Patrick Marsceill
2017-03-09 13:16:08 -05:00
commit b7b0d0d7bf
4147 changed files with 401224 additions and 0 deletions

106
node_modules/table/dist/alignString.js generated vendored Normal file
View File

@@ -0,0 +1,106 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _stringWidth = require('string-width');
var _stringWidth2 = _interopRequireDefault(_stringWidth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const alignments = ['left', 'right', 'center'];
/**
* @param {string} subject
* @param {number} width
* @returns {string}
*/
const alignLeft = (subject, width) => {
return subject + _lodash2.default.repeat(' ', width);
};
/**
* @param {string} subject
* @param {number} width
* @returns {string}
*/
const alignRight = (subject, width) => {
return _lodash2.default.repeat(' ', width) + subject;
};
/**
* @param {string} subject
* @param {number} width
* @returns {string}
*/
const alignCenter = (subject, width) => {
let halfWidth;
halfWidth = width / 2;
if (halfWidth % 2 === 0) {
return _lodash2.default.repeat(' ', halfWidth) + subject + _lodash2.default.repeat(' ', halfWidth);
} else {
halfWidth = _lodash2.default.floor(halfWidth);
return _lodash2.default.repeat(' ', halfWidth) + subject + _lodash2.default.repeat(' ', halfWidth + 1);
}
};
/**
* Pads a string to the left and/or right to position the subject
* text in a desired alignment within a container.
*
* @param {string} subject
* @param {number} containerWidth
* @param {string} alignment One of the valid options (left, right, center).
* @returns {string}
*/
exports.default = (subject, containerWidth, alignment) => {
if (!_lodash2.default.isString(subject)) {
throw new Error('Subject parameter value must be a string.');
}
if (!_lodash2.default.isNumber(containerWidth)) {
throw new Error('Container width parameter value must be a number.');
}
const subjectWidth = (0, _stringWidth2.default)(subject);
if (subjectWidth > containerWidth) {
// console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject);
throw new Error('Subject parameter value width cannot be greater than the container width.');
}
if (!_lodash2.default.isString(alignment)) {
throw new Error('Alignment parameter value must be a string.');
}
if (alignments.indexOf(alignment) === -1) {
throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');
}
if (subjectWidth === 0) {
return _lodash2.default.repeat(' ', containerWidth);
}
const availableWidth = containerWidth - subjectWidth;
if (alignment === 'left') {
return alignLeft(subject, availableWidth);
}
if (alignment === 'right') {
return alignRight(subject, availableWidth);
}
return alignCenter(subject, availableWidth);
};

38
node_modules/table/dist/alignTableData.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _stringWidth = require('string-width');
var _stringWidth2 = _interopRequireDefault(_stringWidth);
var _alignString = require('./alignString');
var _alignString2 = _interopRequireDefault(_alignString);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {table~row[]} rows
* @param {Object} config
* @returns {table~row[]}
*/
exports.default = (rows, config) => {
return _lodash2.default.map(rows, cells => {
return _lodash2.default.map(cells, (value, index1) => {
const column = config.columns[index1];
if ((0, _stringWidth2.default)(value) === column.width) {
return value;
} else {
return (0, _alignString2.default)(value, column.width, column.alignment);
}
});
});
};

47
node_modules/table/dist/calculateCellHeight.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _stringWidth = require('string-width');
var _stringWidth2 = _interopRequireDefault(_stringWidth);
var _wrapWord = require('./wrapWord');
var _wrapWord2 = _interopRequireDefault(_wrapWord);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {string} value
* @param {number} columnWidth
* @param {boolean} useWrapWord
* @returns {number}
*/
exports.default = function (value, columnWidth) {
let useWrapWord = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (!_lodash2.default.isString(value)) {
throw new Error('Value must be a string.');
}
if (!_lodash2.default.isInteger(columnWidth)) {
throw new Error('Column width must be an integer.');
}
if (columnWidth < 1) {
throw new Error('Column width must be greater than 0.');
}
if (useWrapWord) {
return (0, _wrapWord2.default)(value, columnWidth).length;
}
return _lodash2.default.ceil((0, _stringWidth2.default)(value) / columnWidth);
};

27
node_modules/table/dist/calculateCellWidthIndex.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _stringWidth = require('string-width');
var _stringWidth2 = _interopRequireDefault(_stringWidth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Calculates width of each cell contents.
*
* @param {string[]} cells
* @returns {number[]}
*/
exports.default = cells => {
return _lodash2.default.map(cells, value => {
return (0, _stringWidth2.default)(value);
});
};

View File

@@ -0,0 +1,41 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _calculateCellWidthIndex = require('./calculateCellWidthIndex');
var _calculateCellWidthIndex2 = _interopRequireDefault(_calculateCellWidthIndex);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Produces an array of values that describe the largest value length (width) in every column.
*
* @param {Array[]} rows
* @returns {number[]}
*/
exports.default = rows => {
if (!rows[0]) {
throw new Error('Dataset must have at least one row.');
}
const columns = _lodash2.default.fill(Array(rows[0].length), 0);
_lodash2.default.forEach(rows, row => {
const columnWidthIndex = (0, _calculateCellWidthIndex2.default)(row);
_lodash2.default.forEach(columnWidthIndex, (valueWidth, index0) => {
if (columns[index0] < valueWidth) {
columns[index0] = valueWidth;
}
});
});
return columns;
};

48
node_modules/table/dist/calculateRowHeightIndex.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _calculateCellHeight = require('./calculateCellHeight');
var _calculateCellHeight2 = _interopRequireDefault(_calculateCellHeight);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Calculates the vertical row span index.
*
* @param {Array[]} rows
* @param {Object} config
* @returns {number[]}
*/
exports.default = (rows, config) => {
const tableWidth = rows[0].length;
const rowSpanIndex = [];
_lodash2.default.forEach(rows, cells => {
const cellHeightIndex = _lodash2.default.fill(Array(tableWidth), 1);
_lodash2.default.forEach(cells, (value, index1) => {
if (!_lodash2.default.isNumber(config.columns[index1].width)) {
throw new Error('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.');
}
cellHeightIndex[index1] = (0, _calculateCellHeight2.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
});
rowSpanIndex.push(_lodash2.default.max(cellHeightIndex));
});
return rowSpanIndex;
};

157
node_modules/table/dist/createStream.js generated vendored Normal file
View File

@@ -0,0 +1,157 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _makeStreamConfig = require('./makeStreamConfig');
var _makeStreamConfig2 = _interopRequireDefault(_makeStreamConfig);
var _drawRow = require('./drawRow');
var _drawRow2 = _interopRequireDefault(_drawRow);
var _drawBorder = require('./drawBorder');
var _stringifyTableData = require('./stringifyTableData');
var _stringifyTableData2 = _interopRequireDefault(_stringifyTableData);
var _truncateTableData = require('./truncateTableData');
var _truncateTableData2 = _interopRequireDefault(_truncateTableData);
var _mapDataUsingRowHeightIndex = require('./mapDataUsingRowHeightIndex');
var _mapDataUsingRowHeightIndex2 = _interopRequireDefault(_mapDataUsingRowHeightIndex);
var _alignTableData = require('./alignTableData');
var _alignTableData2 = _interopRequireDefault(_alignTableData);
var _padTableData = require('./padTableData');
var _padTableData2 = _interopRequireDefault(_padTableData);
var _calculateRowHeightIndex = require('./calculateRowHeightIndex');
var _calculateRowHeightIndex2 = _interopRequireDefault(_calculateRowHeightIndex);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {Array} data
* @param {Object} config
* @returns {Array}
*/
const prepareData = (data, config) => {
let rows;
rows = (0, _stringifyTableData2.default)(data);
rows = (0, _truncateTableData2.default)(data, config);
const rowHeightIndex = (0, _calculateRowHeightIndex2.default)(rows, config);
rows = (0, _mapDataUsingRowHeightIndex2.default)(rows, rowHeightIndex, config);
rows = (0, _alignTableData2.default)(rows, config);
rows = (0, _padTableData2.default)(rows, config);
return rows;
};
/**
* @param {string[]} row
* @param {number[]} columnWidthIndex
* @param {Object} config
* @returns {undefined}
*/
const create = (row, columnWidthIndex, config) => {
const rows = prepareData([row], config);
const body = _lodash2.default.map(rows, literalRow => {
return (0, _drawRow2.default)(literalRow, config.border);
}).join('');
let output;
output = '';
output += (0, _drawBorder.drawBorderTop)(columnWidthIndex, config.border);
output += body;
output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border);
output = _lodash2.default.trimEnd(output);
process.stdout.write(output);
};
/**
* @param {string[]} row
* @param {number[]} columnWidthIndex
* @param {Object} config
* @returns {undefined}
*/
const append = (row, columnWidthIndex, config) => {
const rows = prepareData([row], config);
const body = _lodash2.default.map(rows, literalRow => {
return (0, _drawRow2.default)(literalRow, config.border);
}).join('');
let output;
output = '\r\x1b[K';
output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config.border);
output += body;
output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border);
output = _lodash2.default.trimEnd(output);
process.stdout.write(output);
};
/**
* @param {Object} userConfig
* @returns {Object}
*/
exports.default = function () {
let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
const config = (0, _makeStreamConfig2.default)(userConfig);
const columnWidthIndex = _lodash2.default.mapValues(config.columns, column => {
return column.width + column.paddingLeft + column.paddingRight;
});
let empty;
empty = true;
return {
/**
* @param {string[]} row
* @returns {undefined}
*/
write: row => {
if (row.length !== config.columnCount) {
throw new Error('Row cell count does not match the config.columnCount.');
}
if (empty) {
empty = false;
return create(row, columnWidthIndex, config);
} else {
return append(row, columnWidthIndex, config);
}
}
};
};

104
node_modules/table/dist/drawBorder.js generated vendored Normal file
View File

@@ -0,0 +1,104 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = undefined;
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @typedef drawBorder~parts
* @property {string} left
* @property {string} right
* @property {string} body
* @property {string} join
*/
/**
* @param {number[]} columnSizeIndex
* @param {drawBorder~parts} parts
* @returns {string}
*/
const drawBorder = (columnSizeIndex, parts) => {
const columns = _lodash2.default.map(columnSizeIndex, size => {
return _lodash2.default.repeat(parts.body, size);
}).join(parts.join);
return parts.left + columns + parts.right + '\n';
};
/**
* @typedef drawBorderTop~parts
* @property {string} topLeft
* @property {string} topRight
* @property {string} topBody
* @property {string} topJoin
*/
/**
* @param {number[]} columnSizeIndex
* @param {drawBorderTop~parts} parts
* @returns {string}
*/
const drawBorderTop = (columnSizeIndex, parts) => {
return drawBorder(columnSizeIndex, {
body: parts.topBody,
join: parts.topJoin,
left: parts.topLeft,
right: parts.topRight
});
};
/**
* @typedef drawBorderJoin~parts
* @property {string} joinLeft
* @property {string} joinRight
* @property {string} joinBody
* @property {string} joinJoin
*/
/**
* @param {number[]} columnSizeIndex
* @param {drawBorderJoin~parts} parts
* @returns {string}
*/
const drawBorderJoin = (columnSizeIndex, parts) => {
return drawBorder(columnSizeIndex, {
body: parts.joinBody,
join: parts.joinJoin,
left: parts.joinLeft,
right: parts.joinRight
});
};
/**
* @typedef drawBorderBottom~parts
* @property {string} topLeft
* @property {string} topRight
* @property {string} topBody
* @property {string} topJoin
*/
/**
* @param {number[]} columnSizeIndex
* @param {drawBorderBottom~parts} parts
* @returns {string}
*/
const drawBorderBottom = (columnSizeIndex, parts) => {
return drawBorder(columnSizeIndex, {
body: parts.bottomBody,
join: parts.bottomJoin,
left: parts.bottomLeft,
right: parts.bottomRight
});
};
exports.drawBorder = drawBorder;
exports.drawBorderBottom = drawBorderBottom;
exports.drawBorderJoin = drawBorderJoin;
exports.drawBorderTop = drawBorderTop;

21
node_modules/table/dist/drawRow.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* @typedef {Object} drawRow~border
* @property {string} bodyLeft
* @property {string} bodyRight
* @property {string} bodyJoin
*/
/**
* @param {number[]} columns
* @param {drawRow~border} border
* @returns {string}
*/
exports.default = (columns, border) => {
return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n';
};

61
node_modules/table/dist/drawTable.js generated vendored Normal file
View File

@@ -0,0 +1,61 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _drawBorder = require('./drawBorder');
var _drawRow = require('./drawRow');
var _drawRow2 = _interopRequireDefault(_drawRow);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {Array} rows
* @param {Object} border
* @param {Array} columnSizeIndex
* @param {Array} rowSpanIndex
* @param {Function} drawHorizontalLine
* @returns {string}
*/
exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => {
let output, realRowIndex, rowHeight;
const rowCount = rows.length;
realRowIndex = 0;
output = '';
if (drawHorizontalLine(realRowIndex, rowCount)) {
output += (0, _drawBorder.drawBorderTop)(columnSizeIndex, border);
}
_lodash2.default.forEach(rows, (row, index0) => {
output += (0, _drawRow2.default)(row, border);
if (!rowHeight) {
rowHeight = rowSpanIndex[realRowIndex];
realRowIndex++;
}
rowHeight--;
if (rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {
output += (0, _drawBorder.drawBorderJoin)(columnSizeIndex, border);
}
});
if (drawHorizontalLine(realRowIndex, rowCount)) {
output += (0, _drawBorder.drawBorderBottom)(columnSizeIndex, border);
}
return output;
};

126
node_modules/table/dist/getBorderCharacters.js generated vendored Normal file
View File

@@ -0,0 +1,126 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/* eslint-disable sort-keys */
/**
* @typedef border
* @property {string} topBody
* @property {string} topJoin
* @property {string} topLeft
* @property {string} topRight
* @property {string} bottomBody
* @property {string} bottomJoin
* @property {string} bottomLeft
* @property {string} bottomRight
* @property {string} bodyLeft
* @property {string} bodyRight
* @property {string} bodyJoin
* @property {string} joinBody
* @property {string} joinLeft
* @property {string} joinRight
* @property {string} joinJoin
*/
/**
* @param {string} name
* @returns {border}
*/
exports.default = name => {
if (name === 'honeywell') {
return {
topBody: '═',
topJoin: '╤',
topLeft: '╔',
topRight: '╗',
bottomBody: '═',
bottomJoin: '╧',
bottomLeft: '╚',
bottomRight: '╝',
bodyLeft: '║',
bodyRight: '║',
bodyJoin: '│',
joinBody: '─',
joinLeft: '╟',
joinRight: '╢',
joinJoin: '┼'
};
}
if (name === 'norc') {
return {
topBody: '─',
topJoin: '┬',
topLeft: '┌',
topRight: '┐',
bottomBody: '─',
bottomJoin: '┴',
bottomLeft: '└',
bottomRight: '┘',
bodyLeft: '│',
bodyRight: '│',
bodyJoin: '│',
joinBody: '─',
joinLeft: '├',
joinRight: '┤',
joinJoin: '┼'
};
}
if (name === 'ramac') {
return {
topBody: '-',
topJoin: '+',
topLeft: '+',
topRight: '+',
bottomBody: '-',
bottomJoin: '+',
bottomLeft: '+',
bottomRight: '+',
bodyLeft: '|',
bodyRight: '|',
bodyJoin: '|',
joinBody: '-',
joinLeft: '|',
joinRight: '|',
joinJoin: '|'
};
}
if (name === 'void') {
return {
topBody: '',
topJoin: '',
topLeft: '',
topRight: '',
bottomBody: '',
bottomJoin: '',
bottomLeft: '',
bottomRight: '',
bodyLeft: '',
bodyRight: '',
bodyJoin: '',
joinBody: '',
joinLeft: '',
joinRight: '',
joinJoin: ''
};
}
throw new Error('Unknown border template "' + name + '".');
};

24
node_modules/table/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getBorderCharacters = exports.createStream = exports.table = undefined;
var _table = require('./table');
var _table2 = _interopRequireDefault(_table);
var _createStream = require('./createStream');
var _createStream2 = _interopRequireDefault(_createStream);
var _getBorderCharacters = require('./getBorderCharacters');
var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.table = _table2.default;
exports.createStream = _createStream2.default;
exports.getBorderCharacters = _getBorderCharacters2.default;

99
node_modules/table/dist/makeConfig.js generated vendored Normal file
View File

@@ -0,0 +1,99 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _getBorderCharacters = require('./getBorderCharacters');
var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters);
var _validateConfig = require('./validateConfig');
var _validateConfig2 = _interopRequireDefault(_validateConfig);
var _calculateMaximumColumnWidthIndex = require('./calculateMaximumColumnWidthIndex');
var _calculateMaximumColumnWidthIndex2 = _interopRequireDefault(_calculateMaximumColumnWidthIndex);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Merges user provided border characters with the default border ("honeywell") characters.
*
* @param {Object} border
* @returns {Object}
*/
const makeBorder = function makeBorder() {
let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return _lodash2.default.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border);
};
/**
* Creates a configuration for every column using default
* values for the missing configuration properties.
*
* @param {Array[]} rows
* @param {Object} columns
* @param {Object} columnDefault
* @returns {Object}
*/
const makeColumns = function makeColumns(rows) {
let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let columnDefault = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
const maximumColumnWidthIndex = (0, _calculateMaximumColumnWidthIndex2.default)(rows);
_lodash2.default.times(rows[0].length, index => {
if (_lodash2.default.isUndefined(columns[index])) {
columns[index] = {};
}
columns[index] = _lodash2.default.assign({
alignment: 'left',
paddingLeft: 1,
paddingRight: 1,
truncate: Infinity,
width: maximumColumnWidthIndex[index],
wrapWord: false
}, columnDefault, columns[index]);
});
return columns;
};
/**
* Makes a new configuration object out of the userConfig object
* using default values for the missing configuration properties.
*
* @param {Array[]} rows
* @param {Object} userConfig
* @returns {Object}
*/
exports.default = function (rows) {
let userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
(0, _validateConfig2.default)('config.json', userConfig);
const config = _lodash2.default.cloneDeep(userConfig);
config.border = makeBorder(config.border);
config.columns = makeColumns(rows, config.columns, config.columnDefault);
if (!config.drawHorizontalLine) {
/**
* @returns {boolean}
*/
config.drawHorizontalLine = () => {
return true;
};
}
return config;
};

107
node_modules/table/dist/makeStreamConfig.js generated vendored Normal file
View File

@@ -0,0 +1,107 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _getBorderCharacters = require('./getBorderCharacters');
var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters);
var _validateConfig = require('./validateConfig');
var _validateConfig2 = _interopRequireDefault(_validateConfig);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Merges user provided border characters with the default border ("honeywell") characters.
*
* @param {Object} border
* @returns {Object}
*/
const makeBorder = function makeBorder() {
let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return _lodash2.default.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border);
};
/**
* Creates a configuration for every column using default
* values for the missing configuration properties.
*
* @param {number} columnCount
* @param {Object} columns
* @param {Object} columnDefault
* @returns {Object}
*/
const makeColumns = function makeColumns(columnCount) {
let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let columnDefault = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
_lodash2.default.times(columnCount, index => {
if (_lodash2.default.isUndefined(columns[index])) {
columns[index] = {};
}
columns[index] = _lodash2.default.assign({
alignment: 'left',
paddingLeft: 1,
paddingRight: 1,
truncate: Infinity,
wrapWord: false
}, columnDefault, columns[index]);
});
return columns;
};
/**
* @typedef {Object} columnConfig
* @property {string} alignment
* @property {number} width
* @property {number} truncate
* @property {number} paddingLeft
* @property {number} paddingRight
*/
/**
* @typedef {Object} streamConfig
* @property {columnConfig} columnDefault
* @property {Object} border
* @property {columnConfig[]}
* @property {number} columnCount Number of columns in the table (required).
*/
/**
* Makes a new configuration object out of the userConfig object
* using default values for the missing configuration properties.
*
* @param {streamConfig} userConfig
* @returns {Object}
*/
exports.default = function () {
let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
(0, _validateConfig2.default)('streamConfig.json', userConfig);
const config = _lodash2.default.cloneDeep(userConfig);
if (!config.columnDefault || !config.columnDefault.width) {
throw new Error('Must provide config.columnDefault.width when creating a stream.');
}
if (!config.columnCount) {
throw new Error('Must provide config.columnCount.');
}
config.border = makeBorder(config.border);
config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);
return config;
};

57
node_modules/table/dist/mapDataUsingRowHeightIndex.js generated vendored Normal file
View File

@@ -0,0 +1,57 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _wrapString = require('./wrapString');
var _wrapString2 = _interopRequireDefault(_wrapString);
var _wrapWord = require('./wrapWord');
var _wrapWord2 = _interopRequireDefault(_wrapWord);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {Array} unmappedRows
* @param {number[]} rowHeightIndex
* @param {Object} config
* @returns {Array}
*/
exports.default = (unmappedRows, rowHeightIndex, config) => {
const tableWidth = unmappedRows[0].length;
const mappedRows = _lodash2.default.map(unmappedRows, (cells, index0) => {
const rowHeight = _lodash2.default.times(rowHeightIndex[index0], () => {
return _lodash2.default.fill(Array(tableWidth), '');
});
// rowHeight
// [{row index within rowSaw; index2}]
// [{cell index within a virtual row; index1}]
_lodash2.default.forEach(cells, (value, index1) => {
let chunkedValue;
if (config.columns[index1].wrapWord) {
chunkedValue = (0, _wrapWord2.default)(value, config.columns[index1].width);
} else {
chunkedValue = (0, _wrapString2.default)(value, config.columns[index1].width);
}
_lodash2.default.forEach(chunkedValue, (part, index2) => {
rowHeight[index2][index1] = part;
});
});
return rowHeight;
});
return _lodash2.default.flatten(mappedRows);
};

26
node_modules/table/dist/padTableData.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {table~row[]} rows
* @param {Object} config
* @returns {table~row[]}
*/
exports.default = (rows, config) => {
return _lodash2.default.map(rows, cells => {
return _lodash2.default.map(cells, (value, index1) => {
const column = config.columns[index1];
return _lodash2.default.repeat(' ', column.paddingLeft) + value + _lodash2.default.repeat(' ', column.paddingRight);
});
});
};

114
node_modules/table/dist/schemas/config.json generated vendored Normal file
View File

@@ -0,0 +1,114 @@
{
"id": "config.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"border": {
"$ref": "#/definitions/borders"
},
"columns": {
"$ref": "#/definitions/columns"
},
"columnDefault": {
"$ref": "#/definitions/column"
},
"drawHorizontalLine": {
"typeof": "function"
}
},
"additionalProperties": false,
"definitions": {
"columns": {
"type": "object",
"patternProperties": {
"^[0-9]+$": {
"$ref": "#/definitions/column"
}
},
"additionalProperties": false
},
"column": {
"type": "object",
"properties": {
"alignment": {
"type": "string",
"enum": [
"left",
"right",
"center"
]
},
"width": {
"type": "number"
},
"wrapWord": {
"type": "boolean"
},
"truncate": {
"type": "number"
},
"paddingLeft": {
"type": "number"
},
"paddingRight": {
"type": "number"
}
},
"additionalProperties": false
},
"borders": {
"type": "object",
"properties": {
"topBody": {
"$ref": "#/definitions/border"
},
"topJoin": {
"$ref": "#/definitions/border"
},
"topLeft": {
"$ref": "#/definitions/border"
},
"topRight": {
"$ref": "#/definitions/border"
},
"bottomBody": {
"$ref": "#/definitions/border"
},
"bottomJoin": {
"$ref": "#/definitions/border"
},
"bottomLeft": {
"$ref": "#/definitions/border"
},
"bottomRight": {
"$ref": "#/definitions/border"
},
"bodyLeft": {
"$ref": "#/definitions/border"
},
"bodyRight": {
"$ref": "#/definitions/border"
},
"bodyJoin": {
"$ref": "#/definitions/border"
},
"joinBody": {
"$ref": "#/definitions/border"
},
"joinLeft": {
"$ref": "#/definitions/border"
},
"joinRight": {
"$ref": "#/definitions/border"
},
"joinJoin": {
"$ref": "#/definitions/border"
}
},
"additionalProperties": false
},
"border": {
"type": "string"
}
}
}

114
node_modules/table/dist/schemas/streamConfig.json generated vendored Normal file
View File

@@ -0,0 +1,114 @@
{
"id": "streamConfig.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"border": {
"$ref": "#/definitions/borders"
},
"columns": {
"$ref": "#/definitions/columns"
},
"columnDefault": {
"$ref": "#/definitions/column"
},
"columnCount": {
"type": "number"
}
},
"additionalProperties": false,
"definitions": {
"columns": {
"type": "object",
"patternProperties": {
"^[0-9]+$": {
"$ref": "#/definitions/column"
}
},
"additionalProperties": false
},
"column": {
"type": "object",
"properties": {
"alignment": {
"type": "string",
"enum": [
"left",
"right",
"center"
]
},
"width": {
"type": "number"
},
"wrapWord": {
"type": "boolean"
},
"truncate": {
"type": "number"
},
"paddingLeft": {
"type": "number"
},
"paddingRight": {
"type": "number"
}
},
"additionalProperties": false
},
"borders": {
"type": "object",
"properties": {
"topBody": {
"$ref": "#/definitions/border"
},
"topJoin": {
"$ref": "#/definitions/border"
},
"topLeft": {
"$ref": "#/definitions/border"
},
"topRight": {
"$ref": "#/definitions/border"
},
"bottomBody": {
"$ref": "#/definitions/border"
},
"bottomJoin": {
"$ref": "#/definitions/border"
},
"bottomLeft": {
"$ref": "#/definitions/border"
},
"bottomRight": {
"$ref": "#/definitions/border"
},
"bodyLeft": {
"$ref": "#/definitions/border"
},
"bodyRight": {
"$ref": "#/definitions/border"
},
"bodyJoin": {
"$ref": "#/definitions/border"
},
"joinBody": {
"$ref": "#/definitions/border"
},
"joinLeft": {
"$ref": "#/definitions/border"
},
"joinRight": {
"$ref": "#/definitions/border"
},
"joinJoin": {
"$ref": "#/definitions/border"
}
},
"additionalProperties": false
},
"border": {
"type": "string"
}
}
}

23
node_modules/table/dist/stringifyTableData.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Casts all cell values to a string.
*
* @param {table~row[]} rows
* @returns {table~row[]}
*/
exports.default = rows => {
return _lodash2.default.map(rows, cells => {
return _lodash2.default.map(cells, String);
});
};

133
node_modules/table/dist/table.js generated vendored Normal file
View File

@@ -0,0 +1,133 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _drawTable = require('./drawTable');
var _drawTable2 = _interopRequireDefault(_drawTable);
var _calculateCellWidthIndex = require('./calculateCellWidthIndex');
var _calculateCellWidthIndex2 = _interopRequireDefault(_calculateCellWidthIndex);
var _makeConfig = require('./makeConfig');
var _makeConfig2 = _interopRequireDefault(_makeConfig);
var _calculateRowHeightIndex = require('./calculateRowHeightIndex');
var _calculateRowHeightIndex2 = _interopRequireDefault(_calculateRowHeightIndex);
var _mapDataUsingRowHeightIndex = require('./mapDataUsingRowHeightIndex');
var _mapDataUsingRowHeightIndex2 = _interopRequireDefault(_mapDataUsingRowHeightIndex);
var _alignTableData = require('./alignTableData');
var _alignTableData2 = _interopRequireDefault(_alignTableData);
var _padTableData = require('./padTableData');
var _padTableData2 = _interopRequireDefault(_padTableData);
var _validateTableData = require('./validateTableData');
var _validateTableData2 = _interopRequireDefault(_validateTableData);
var _stringifyTableData = require('./stringifyTableData');
var _stringifyTableData2 = _interopRequireDefault(_stringifyTableData);
var _truncateTableData = require('./truncateTableData');
var _truncateTableData2 = _interopRequireDefault(_truncateTableData);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @typedef {string} table~cell
*/
/**
* @typedef {table~cell[]} table~row
*/
/**
* @typedef {Object} table~columns
* @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).
* @property {number} width Column width (default: auto).
* @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).
* @property {number} paddingLeft Cell content padding width left (default: 1).
* @property {number} paddingRight Cell content padding width right (default: 1).
*/
/**
* @typedef {Object} table~border
* @property {string} topBody
* @property {string} topJoin
* @property {string} topLeft
* @property {string} topRight
* @property {string} bottomBody
* @property {string} bottomJoin
* @property {string} bottomLeft
* @property {string} bottomRight
* @property {string} bodyLeft
* @property {string} bodyRight
* @property {string} bodyJoin
* @property {string} joinBody
* @property {string} joinLeft
* @property {string} joinRight
* @property {string} joinJoin
*/
/**
* Used to tell whether to draw a horizontal line.
* This callback is called for each non-content line of the table.
* The default behavior is to always return true.
*
* @typedef {Function} drawHorizontalLine
* @param {number} index
* @param {number} size
* @returns {boolean}
*/
/**
* @typedef {Object} table~config
* @property {table~border} border
* @property {table~columns[]} columns Column specific configuration.
* @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.
* @property {table~drawHorizontalLine} drawHorizontalLine
*/
/**
* Generates a text table.
*
* @param {table~row[]} data
* @param {table~config} userConfig
* @returns {string}
*/
exports.default = function (data) {
let userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let rows;
(0, _validateTableData2.default)(data);
rows = (0, _stringifyTableData2.default)(data);
const config = (0, _makeConfig2.default)(rows, userConfig);
rows = (0, _truncateTableData2.default)(data, config);
const rowHeightIndex = (0, _calculateRowHeightIndex2.default)(rows, config);
rows = (0, _mapDataUsingRowHeightIndex2.default)(rows, rowHeightIndex, config);
rows = (0, _alignTableData2.default)(rows, config);
rows = (0, _padTableData2.default)(rows, config);
const cellWidthIndex = (0, _calculateCellWidthIndex2.default)(rows[0]);
return (0, _drawTable2.default)(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine);
};

27
node_modules/table/dist/truncateTableData.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @todo Make it work with ASCII content.
* @param {table~row[]} rows
* @param {Object} config
* @returns {table~row[]}
*/
exports.default = (rows, config) => {
return _lodash2.default.map(rows, cells => {
return _lodash2.default.map(cells, (content, index) => {
return _lodash2.default.truncate(content, {
length: config.columns[index].truncate
});
});
});
};

756
node_modules/table/dist/validateConfig.js generated vendored Normal file
View File

@@ -0,0 +1,756 @@
'use strict';
var equal = require('ajv/lib/compile/equal');
var validate = (function() {
var pattern0 = new RegExp('^[0-9]+$');
var refVal = [];
var refVal1 = (function() {
var pattern0 = new RegExp('^[0-9]+$');
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
var vErrors = null;
var errors = 0;
if (rootData === undefined) rootData = data;
if ((data && typeof data === "object" && !Array.isArray(data))) {
var errs__0 = errors;
var valid1 = true;
for (var key0 in data) {
var isAdditional0 = !(false || validate.schema.properties[key0]);
if (isAdditional0) {
valid1 = false;
var err = {
keyword: 'additionalProperties',
dataPath: (dataPath || '') + "",
schemaPath: '#/additionalProperties',
params: {
additionalProperty: '' + key0 + ''
},
message: 'should NOT have additional properties'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
}
if (data.topBody !== undefined) {
var errs_1 = errors;
if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) {
if (vErrors === null) vErrors = refVal2.errors;
else vErrors = vErrors.concat(refVal2.errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.topJoin !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.topLeft !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.topRight !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bottomBody !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bottomJoin !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bottomLeft !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bottomRight !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bodyLeft !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bodyRight !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bodyJoin !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.joinBody !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.joinLeft !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.joinRight !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.joinJoin !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
} else {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + "",
schemaPath: '#/type',
params: {
type: 'object'
},
message: 'should be object'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
validate.errors = vErrors;
return errors === 0;
};
})();
refVal1.schema = {
"type": "object",
"properties": {
"topBody": {
"$ref": "#/definitions/border"
},
"topJoin": {
"$ref": "#/definitions/border"
},
"topLeft": {
"$ref": "#/definitions/border"
},
"topRight": {
"$ref": "#/definitions/border"
},
"bottomBody": {
"$ref": "#/definitions/border"
},
"bottomJoin": {
"$ref": "#/definitions/border"
},
"bottomLeft": {
"$ref": "#/definitions/border"
},
"bottomRight": {
"$ref": "#/definitions/border"
},
"bodyLeft": {
"$ref": "#/definitions/border"
},
"bodyRight": {
"$ref": "#/definitions/border"
},
"bodyJoin": {
"$ref": "#/definitions/border"
},
"joinBody": {
"$ref": "#/definitions/border"
},
"joinLeft": {
"$ref": "#/definitions/border"
},
"joinRight": {
"$ref": "#/definitions/border"
},
"joinJoin": {
"$ref": "#/definitions/border"
}
},
"additionalProperties": false
};
refVal1.errors = null;
refVal[1] = refVal1;
var refVal2 = (function() {
var pattern0 = new RegExp('^[0-9]+$');
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
var vErrors = null;
var errors = 0;
if (rootData === undefined) rootData = data;
if (typeof data !== "string") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + "",
schemaPath: '#/type',
params: {
type: 'string'
},
message: 'should be string'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
validate.errors = vErrors;
return errors === 0;
};
})();
refVal2.schema = {
"type": "string"
};
refVal2.errors = null;
refVal[2] = refVal2;
var refVal3 = (function() {
var pattern0 = new RegExp('^[0-9]+$');
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
var vErrors = null;
var errors = 0;
if (rootData === undefined) rootData = data;
if ((data && typeof data === "object" && !Array.isArray(data))) {
var errs__0 = errors;
var valid1 = true;
for (var key0 in data) {
var isAdditional0 = !(false || pattern0.test(key0));
if (isAdditional0) {
valid1 = false;
var err = {
keyword: 'additionalProperties',
dataPath: (dataPath || '') + "",
schemaPath: '#/additionalProperties',
params: {
additionalProperty: '' + key0 + ''
},
message: 'should NOT have additional properties'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
}
for (var key0 in data) {
if (pattern0.test(key0)) {
var errs_1 = errors;
if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) {
if (vErrors === null) vErrors = refVal4.errors;
else vErrors = vErrors.concat(refVal4.errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
}
} else {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + "",
schemaPath: '#/type',
params: {
type: 'object'
},
message: 'should be object'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
validate.errors = vErrors;
return errors === 0;
};
})();
refVal3.schema = {
"type": "object",
"patternProperties": {
"^[0-9]+$": {
"$ref": "#/definitions/column"
}
},
"additionalProperties": false
};
refVal3.errors = null;
refVal[3] = refVal3;
var refVal4 = (function() {
var pattern0 = new RegExp('^[0-9]+$');
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
var vErrors = null;
var errors = 0;
if (rootData === undefined) rootData = data;
if ((data && typeof data === "object" && !Array.isArray(data))) {
var errs__0 = errors;
var valid1 = true;
for (var key0 in data) {
var isAdditional0 = !(false || validate.schema.properties[key0]);
if (isAdditional0) {
valid1 = false;
var err = {
keyword: 'additionalProperties',
dataPath: (dataPath || '') + "",
schemaPath: '#/additionalProperties',
params: {
additionalProperty: '' + key0 + ''
},
message: 'should NOT have additional properties'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
}
var data1 = data.alignment;
if (data1 !== undefined) {
var errs_1 = errors;
var schema1 = validate.schema.properties.alignment.enum;
var valid1;
valid1 = false;
for (var i1 = 0; i1 < schema1.length; i1++)
if (equal(data1, schema1[i1])) {
valid1 = true;
break;
}
if (!valid1) {
var err = {
keyword: 'enum',
dataPath: (dataPath || '') + '.alignment',
schemaPath: '#/properties/alignment/enum',
params: {
allowedValues: schema1
},
message: 'should be equal to one of the allowed values'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
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 valid1 = errors === errs_1;
}
if (data.width !== undefined) {
var errs_1 = errors;
if (typeof data.width !== "number") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.width',
schemaPath: '#/properties/width/type',
params: {
type: 'number'
},
message: 'should be number'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
if (data.wrapWord !== undefined) {
var errs_1 = errors;
if (typeof data.wrapWord !== "boolean") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.wrapWord',
schemaPath: '#/properties/wrapWord/type',
params: {
type: 'boolean'
},
message: 'should be boolean'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
if (data.truncate !== undefined) {
var errs_1 = errors;
if (typeof data.truncate !== "number") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.truncate',
schemaPath: '#/properties/truncate/type',
params: {
type: 'number'
},
message: 'should be number'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
if (data.paddingLeft !== undefined) {
var errs_1 = errors;
if (typeof data.paddingLeft !== "number") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.paddingLeft',
schemaPath: '#/properties/paddingLeft/type',
params: {
type: 'number'
},
message: 'should be number'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
if (data.paddingRight !== undefined) {
var errs_1 = errors;
if (typeof data.paddingRight !== "number") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.paddingRight',
schemaPath: '#/properties/paddingRight/type',
params: {
type: 'number'
},
message: 'should be number'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
} else {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + "",
schemaPath: '#/type',
params: {
type: 'object'
},
message: 'should be object'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
validate.errors = vErrors;
return errors === 0;
};
})();
refVal4.schema = {
"type": "object",
"properties": {
"alignment": {
"type": "string",
"enum": ["left", "right", "center"]
},
"width": {
"type": "number"
},
"wrapWord": {
"type": "boolean"
},
"truncate": {
"type": "number"
},
"paddingLeft": {
"type": "number"
},
"paddingRight": {
"type": "number"
}
},
"additionalProperties": false
};
refVal4.errors = null;
refVal[4] = refVal4;
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
var vErrors = null;
var errors = 0;
if (rootData === undefined) rootData = data;
if ((data && typeof data === "object" && !Array.isArray(data))) {
var errs__0 = errors;
var valid1 = true;
for (var key0 in data) {
var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'drawHorizontalLine');
if (isAdditional0) {
valid1 = false;
var err = {
keyword: 'additionalProperties',
dataPath: (dataPath || '') + "",
schemaPath: '#/additionalProperties',
params: {
additionalProperty: '' + key0 + ''
},
message: 'should NOT have additional properties'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
}
if (data.border !== undefined) {
var errs_1 = errors;
if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) {
if (vErrors === null) vErrors = refVal1.errors;
else vErrors = vErrors.concat(refVal1.errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.columns !== undefined) {
var errs_1 = errors;
if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) {
if (vErrors === null) vErrors = refVal3.errors;
else vErrors = vErrors.concat(refVal3.errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.columnDefault !== undefined) {
var errs_1 = errors;
if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) {
if (vErrors === null) vErrors = refVal[4].errors;
else vErrors = vErrors.concat(refVal[4].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.drawHorizontalLine !== undefined) {
var errs_1 = errors;
var errs__1 = errors;
var valid1;
if (!(typeof data.drawHorizontalLine == "function")) {
if (errs__1 == errors) {
var err = {
keyword: 'typeof',
dataPath: (dataPath || '') + '.drawHorizontalLine',
schemaPath: '#/properties/drawHorizontalLine/typeof',
params: {
keyword: 'typeof'
},
message: 'should pass "typeof" keyword validation'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
} else {
for (var i1 = errs__1; i1 < errors; i1++) {
var ruleErr1 = vErrors[i1];
if (ruleErr1.dataPath === undefined) {
ruleErr1.dataPath = (dataPath || '') + '.drawHorizontalLine';
}
if (ruleErr1.schemaPath === undefined) {
ruleErr1.schemaPath = "#/properties/drawHorizontalLine/typeof";
}
}
}
}
var valid1 = errors === errs_1;
}
} else {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + "",
schemaPath: '#/type',
params: {
type: 'object'
},
message: 'should be object'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
validate.errors = vErrors;
return errors === 0;
};
})();
validate.schema = {
"id": "config.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"border": {
"$ref": "#/definitions/borders"
},
"columns": {
"$ref": "#/definitions/columns"
},
"columnDefault": {
"$ref": "#/definitions/column"
},
"drawHorizontalLine": {
"typeof": "function"
}
},
"additionalProperties": false,
"definitions": {
"columns": {
"type": "object",
"patternProperties": {
"^[0-9]+$": {
"$ref": "#/definitions/column"
}
},
"additionalProperties": false
},
"column": {
"type": "object",
"properties": {
"alignment": {
"type": "string",
"enum": ["left", "right", "center"]
},
"width": {
"type": "number"
},
"wrapWord": {
"type": "boolean"
},
"truncate": {
"type": "number"
},
"paddingLeft": {
"type": "number"
},
"paddingRight": {
"type": "number"
}
},
"additionalProperties": false
},
"borders": {
"type": "object",
"properties": {
"topBody": {
"$ref": "#/definitions/border"
},
"topJoin": {
"$ref": "#/definitions/border"
},
"topLeft": {
"$ref": "#/definitions/border"
},
"topRight": {
"$ref": "#/definitions/border"
},
"bottomBody": {
"$ref": "#/definitions/border"
},
"bottomJoin": {
"$ref": "#/definitions/border"
},
"bottomLeft": {
"$ref": "#/definitions/border"
},
"bottomRight": {
"$ref": "#/definitions/border"
},
"bodyLeft": {
"$ref": "#/definitions/border"
},
"bodyRight": {
"$ref": "#/definitions/border"
},
"bodyJoin": {
"$ref": "#/definitions/border"
},
"joinBody": {
"$ref": "#/definitions/border"
},
"joinLeft": {
"$ref": "#/definitions/border"
},
"joinRight": {
"$ref": "#/definitions/border"
},
"joinJoin": {
"$ref": "#/definitions/border"
}
},
"additionalProperties": false
},
"border": {
"type": "string"
}
}
};
validate.errors = null;
module.exports = validate;

742
node_modules/table/dist/validateStreamConfig.js generated vendored Normal file
View File

@@ -0,0 +1,742 @@
'use strict';
var equal = require('ajv/lib/compile/equal');
var validate = (function() {
var pattern0 = new RegExp('^[0-9]+$');
var refVal = [];
var refVal1 = (function() {
var pattern0 = new RegExp('^[0-9]+$');
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
var vErrors = null;
var errors = 0;
if (rootData === undefined) rootData = data;
if ((data && typeof data === "object" && !Array.isArray(data))) {
var errs__0 = errors;
var valid1 = true;
for (var key0 in data) {
var isAdditional0 = !(false || validate.schema.properties[key0]);
if (isAdditional0) {
valid1 = false;
var err = {
keyword: 'additionalProperties',
dataPath: (dataPath || '') + "",
schemaPath: '#/additionalProperties',
params: {
additionalProperty: '' + key0 + ''
},
message: 'should NOT have additional properties'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
}
if (data.topBody !== undefined) {
var errs_1 = errors;
if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) {
if (vErrors === null) vErrors = refVal2.errors;
else vErrors = vErrors.concat(refVal2.errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.topJoin !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.topLeft !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.topRight !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bottomBody !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bottomJoin !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bottomLeft !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bottomRight !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bodyLeft !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bodyRight !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.bodyJoin !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.joinBody !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.joinLeft !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.joinRight !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.joinJoin !== undefined) {
var errs_1 = errors;
if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) {
if (vErrors === null) vErrors = refVal[2].errors;
else vErrors = vErrors.concat(refVal[2].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
} else {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + "",
schemaPath: '#/type',
params: {
type: 'object'
},
message: 'should be object'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
validate.errors = vErrors;
return errors === 0;
};
})();
refVal1.schema = {
"type": "object",
"properties": {
"topBody": {
"$ref": "#/definitions/border"
},
"topJoin": {
"$ref": "#/definitions/border"
},
"topLeft": {
"$ref": "#/definitions/border"
},
"topRight": {
"$ref": "#/definitions/border"
},
"bottomBody": {
"$ref": "#/definitions/border"
},
"bottomJoin": {
"$ref": "#/definitions/border"
},
"bottomLeft": {
"$ref": "#/definitions/border"
},
"bottomRight": {
"$ref": "#/definitions/border"
},
"bodyLeft": {
"$ref": "#/definitions/border"
},
"bodyRight": {
"$ref": "#/definitions/border"
},
"bodyJoin": {
"$ref": "#/definitions/border"
},
"joinBody": {
"$ref": "#/definitions/border"
},
"joinLeft": {
"$ref": "#/definitions/border"
},
"joinRight": {
"$ref": "#/definitions/border"
},
"joinJoin": {
"$ref": "#/definitions/border"
}
},
"additionalProperties": false
};
refVal1.errors = null;
refVal[1] = refVal1;
var refVal2 = (function() {
var pattern0 = new RegExp('^[0-9]+$');
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
var vErrors = null;
var errors = 0;
if (rootData === undefined) rootData = data;
if (typeof data !== "string") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + "",
schemaPath: '#/type',
params: {
type: 'string'
},
message: 'should be string'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
validate.errors = vErrors;
return errors === 0;
};
})();
refVal2.schema = {
"type": "string"
};
refVal2.errors = null;
refVal[2] = refVal2;
var refVal3 = (function() {
var pattern0 = new RegExp('^[0-9]+$');
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
var vErrors = null;
var errors = 0;
if (rootData === undefined) rootData = data;
if ((data && typeof data === "object" && !Array.isArray(data))) {
var errs__0 = errors;
var valid1 = true;
for (var key0 in data) {
var isAdditional0 = !(false || pattern0.test(key0));
if (isAdditional0) {
valid1 = false;
var err = {
keyword: 'additionalProperties',
dataPath: (dataPath || '') + "",
schemaPath: '#/additionalProperties',
params: {
additionalProperty: '' + key0 + ''
},
message: 'should NOT have additional properties'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
}
for (var key0 in data) {
if (pattern0.test(key0)) {
var errs_1 = errors;
if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) {
if (vErrors === null) vErrors = refVal4.errors;
else vErrors = vErrors.concat(refVal4.errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
}
} else {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + "",
schemaPath: '#/type',
params: {
type: 'object'
},
message: 'should be object'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
validate.errors = vErrors;
return errors === 0;
};
})();
refVal3.schema = {
"type": "object",
"patternProperties": {
"^[0-9]+$": {
"$ref": "#/definitions/column"
}
},
"additionalProperties": false
};
refVal3.errors = null;
refVal[3] = refVal3;
var refVal4 = (function() {
var pattern0 = new RegExp('^[0-9]+$');
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
var vErrors = null;
var errors = 0;
if (rootData === undefined) rootData = data;
if ((data && typeof data === "object" && !Array.isArray(data))) {
var errs__0 = errors;
var valid1 = true;
for (var key0 in data) {
var isAdditional0 = !(false || validate.schema.properties[key0]);
if (isAdditional0) {
valid1 = false;
var err = {
keyword: 'additionalProperties',
dataPath: (dataPath || '') + "",
schemaPath: '#/additionalProperties',
params: {
additionalProperty: '' + key0 + ''
},
message: 'should NOT have additional properties'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
}
var data1 = data.alignment;
if (data1 !== undefined) {
var errs_1 = errors;
var schema1 = validate.schema.properties.alignment.enum;
var valid1;
valid1 = false;
for (var i1 = 0; i1 < schema1.length; i1++)
if (equal(data1, schema1[i1])) {
valid1 = true;
break;
}
if (!valid1) {
var err = {
keyword: 'enum',
dataPath: (dataPath || '') + '.alignment',
schemaPath: '#/properties/alignment/enum',
params: {
allowedValues: schema1
},
message: 'should be equal to one of the allowed values'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
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 valid1 = errors === errs_1;
}
if (data.width !== undefined) {
var errs_1 = errors;
if (typeof data.width !== "number") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.width',
schemaPath: '#/properties/width/type',
params: {
type: 'number'
},
message: 'should be number'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
if (data.wrapWord !== undefined) {
var errs_1 = errors;
if (typeof data.wrapWord !== "boolean") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.wrapWord',
schemaPath: '#/properties/wrapWord/type',
params: {
type: 'boolean'
},
message: 'should be boolean'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
if (data.truncate !== undefined) {
var errs_1 = errors;
if (typeof data.truncate !== "number") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.truncate',
schemaPath: '#/properties/truncate/type',
params: {
type: 'number'
},
message: 'should be number'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
if (data.paddingLeft !== undefined) {
var errs_1 = errors;
if (typeof data.paddingLeft !== "number") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.paddingLeft',
schemaPath: '#/properties/paddingLeft/type',
params: {
type: 'number'
},
message: 'should be number'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
if (data.paddingRight !== undefined) {
var errs_1 = errors;
if (typeof data.paddingRight !== "number") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.paddingRight',
schemaPath: '#/properties/paddingRight/type',
params: {
type: 'number'
},
message: 'should be number'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
} else {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + "",
schemaPath: '#/type',
params: {
type: 'object'
},
message: 'should be object'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
validate.errors = vErrors;
return errors === 0;
};
})();
refVal4.schema = {
"type": "object",
"properties": {
"alignment": {
"type": "string",
"enum": ["left", "right", "center"]
},
"width": {
"type": "number"
},
"wrapWord": {
"type": "boolean"
},
"truncate": {
"type": "number"
},
"paddingLeft": {
"type": "number"
},
"paddingRight": {
"type": "number"
}
},
"additionalProperties": false
};
refVal4.errors = null;
refVal[4] = refVal4;
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
var vErrors = null;
var errors = 0;
if (rootData === undefined) rootData = data;
if ((data && typeof data === "object" && !Array.isArray(data))) {
var errs__0 = errors;
var valid1 = true;
for (var key0 in data) {
var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'columnCount');
if (isAdditional0) {
valid1 = false;
var err = {
keyword: 'additionalProperties',
dataPath: (dataPath || '') + "",
schemaPath: '#/additionalProperties',
params: {
additionalProperty: '' + key0 + ''
},
message: 'should NOT have additional properties'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
}
if (data.border !== undefined) {
var errs_1 = errors;
if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) {
if (vErrors === null) vErrors = refVal1.errors;
else vErrors = vErrors.concat(refVal1.errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.columns !== undefined) {
var errs_1 = errors;
if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) {
if (vErrors === null) vErrors = refVal3.errors;
else vErrors = vErrors.concat(refVal3.errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.columnDefault !== undefined) {
var errs_1 = errors;
if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) {
if (vErrors === null) vErrors = refVal[4].errors;
else vErrors = vErrors.concat(refVal[4].errors);
errors = vErrors.length;
}
var valid1 = errors === errs_1;
}
if (data.columnCount !== undefined) {
var errs_1 = errors;
if (typeof data.columnCount !== "number") {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + '.columnCount',
schemaPath: '#/properties/columnCount/type',
params: {
type: 'number'
},
message: 'should be number'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
var valid1 = errors === errs_1;
}
} else {
var err = {
keyword: 'type',
dataPath: (dataPath || '') + "",
schemaPath: '#/type',
params: {
type: 'object'
},
message: 'should be object'
};
if (vErrors === null) vErrors = [err];
else vErrors.push(err);
errors++;
}
validate.errors = vErrors;
return errors === 0;
};
})();
validate.schema = {
"id": "streamConfig.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"border": {
"$ref": "#/definitions/borders"
},
"columns": {
"$ref": "#/definitions/columns"
},
"columnDefault": {
"$ref": "#/definitions/column"
},
"columnCount": {
"type": "number"
}
},
"additionalProperties": false,
"definitions": {
"columns": {
"type": "object",
"patternProperties": {
"^[0-9]+$": {
"$ref": "#/definitions/column"
}
},
"additionalProperties": false
},
"column": {
"type": "object",
"properties": {
"alignment": {
"type": "string",
"enum": ["left", "right", "center"]
},
"width": {
"type": "number"
},
"wrapWord": {
"type": "boolean"
},
"truncate": {
"type": "number"
},
"paddingLeft": {
"type": "number"
},
"paddingRight": {
"type": "number"
}
},
"additionalProperties": false
},
"borders": {
"type": "object",
"properties": {
"topBody": {
"$ref": "#/definitions/border"
},
"topJoin": {
"$ref": "#/definitions/border"
},
"topLeft": {
"$ref": "#/definitions/border"
},
"topRight": {
"$ref": "#/definitions/border"
},
"bottomBody": {
"$ref": "#/definitions/border"
},
"bottomJoin": {
"$ref": "#/definitions/border"
},
"bottomLeft": {
"$ref": "#/definitions/border"
},
"bottomRight": {
"$ref": "#/definitions/border"
},
"bodyLeft": {
"$ref": "#/definitions/border"
},
"bodyRight": {
"$ref": "#/definitions/border"
},
"bodyJoin": {
"$ref": "#/definitions/border"
},
"joinBody": {
"$ref": "#/definitions/border"
},
"joinLeft": {
"$ref": "#/definitions/border"
},
"joinRight": {
"$ref": "#/definitions/border"
},
"joinJoin": {
"$ref": "#/definitions/border"
}
},
"additionalProperties": false
},
"border": {
"type": "string"
}
}
};
validate.errors = null;
module.exports = validate;

57
node_modules/table/dist/validateTableData.js generated vendored Normal file
View File

@@ -0,0 +1,57 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @typedef {string} cell
*/
/**
* @typedef {cell[]} validateData~column
*/
/**
* @param {column[]} rows
* @returns {undefined}
*/
exports.default = rows => {
if (!_lodash2.default.isArray(rows)) {
throw new Error('Table data must be an array.');
}
if (rows.length === 0) {
throw new Error('Table must define at least one row.');
}
if (rows[0].length === 0) {
throw new Error('Table must define at least one column.');
}
const columnNumber = rows[0].length;
_lodash2.default.forEach(rows, cells => {
if (!_lodash2.default.isArray(cells)) {
throw new Error('Table row data must be an array.');
}
if (cells.length !== columnNumber) {
throw new Error('Table must have a consistent number of cells.');
}
// @todo Make an exception for newline characters.
// @see https://github.com/gajus/table/issues/9
_lodash2.default.forEach(cells, cell => {
if (/[\x01-\x1A]/.test(cell)) {
throw new Error('Table data must not contain control characters.');
}
});
});
};

46
node_modules/table/dist/wrapString.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _sliceAnsi = require('slice-ansi');
var _sliceAnsi2 = _interopRequireDefault(_sliceAnsi);
var _stringWidth = require('string-width');
var _stringWidth2 = _interopRequireDefault(_stringWidth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Creates an array of strings split into groups the length of size.
* This function works with strings that contain ASCII characters.
*
* wrapText is different from would-be "chunk" implementation
* in that whitespace characters that occur on a chunk size limit are trimmed.
*
* @param {string} subject
* @param {number} size
* @returns {Array}
*/
exports.default = (subject, size) => {
let subjectSlice;
subjectSlice = subject;
const chunks = [];
do {
chunks.push((0, _sliceAnsi2.default)(subjectSlice, 0, size));
subjectSlice = _lodash2.default.trim((0, _sliceAnsi2.default)(subjectSlice, size));
} while ((0, _stringWidth2.default)(subjectSlice));
return chunks;
};

56
node_modules/table/dist/wrapWord.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _sliceAnsi = require('slice-ansi');
var _sliceAnsi2 = _interopRequireDefault(_sliceAnsi);
var _stringWidth = require('string-width');
var _stringWidth2 = _interopRequireDefault(_stringWidth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {string} input
* @param {number} size
* @returns {Array}
*/
exports.default = (input, size) => {
let subject;
subject = input;
const chunks = [];
// https://regex101.com/r/gY5kZ1/1
const re = new RegExp('(^.{1,' + size + '}(\\s+|$))|(^.{1,' + (size - 1) + '}(\\\\|/|_|\\.|,|;|-))');
do {
let chunk;
chunk = subject.match(re);
if (chunk) {
chunk = chunk[0];
subject = (0, _sliceAnsi2.default)(subject, (0, _stringWidth2.default)(chunk));
chunk = _lodash2.default.trim(chunk);
} else {
chunk = (0, _sliceAnsi2.default)(subject, 0, size);
subject = (0, _sliceAnsi2.default)(subject, size);
}
chunks.push(chunk);
} while ((0, _stringWidth2.default)(subject));
return chunks;
};