Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2021-07-27 16:54:26 +00:00
parent 6b0d45a5c6
commit cc1adb825a
4247 changed files with 144820 additions and 149530 deletions

938
node_modules/table/README.md generated vendored

File diff suppressed because it is too large Load diff

6
node_modules/table/dist/alignString.d.ts generated vendored Normal file
View file

@ -0,0 +1,6 @@
import type { Alignment } from './types/api';
/**
* Pads a string to the left and/or right to position the subject
* text in a desired alignment within a container.
*/
export declare const alignString: (subject: string, containerWidth: number, alignment: Alignment) => string;

View file

@ -1,108 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
var _isString2 = _interopRequireDefault(require("lodash/isString"));
var _stringWidth = _interopRequireDefault(require("string-width"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const alignments = ['left', 'right', 'center'];
/**
* @param {string} subject
* @param {number} width
* @returns {string}
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.alignString = void 0;
const string_width_1 = __importDefault(require("string-width"));
const utils_1 = require("./utils");
const alignLeft = (subject, width) => {
return subject + ' '.repeat(width);
return subject + ' '.repeat(width);
};
/**
* @param {string} subject
* @param {number} width
* @returns {string}
*/
const alignRight = (subject, width) => {
return ' '.repeat(width) + subject;
return ' '.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 ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth);
} else {
halfWidth = Math.floor(halfWidth);
return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1);
}
return ' '.repeat(Math.floor(width / 2)) + subject + ' '.repeat(Math.ceil(width / 2));
};
const alignJustify = (subject, width) => {
const spaceSequenceCount = utils_1.countSpaceSequence(subject);
if (spaceSequenceCount === 0) {
return alignLeft(subject, width);
}
const addingSpaces = utils_1.distributeUnevenly(width, spaceSequenceCount);
if (Math.max(...addingSpaces) > 3) {
return alignLeft(subject, width);
}
let spaceSequenceIndex = 0;
return subject.replace(/\s+/g, (groupSpace) => {
return groupSpace + ' '.repeat(addingSpaces[spaceSequenceIndex++]);
});
};
/**
* 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}
*/
const alignString = (subject, containerWidth, alignment) => {
if (!(0, _isString2.default)(subject)) {
throw new TypeError('Subject parameter value must be a string.');
}
if (!(0, _isNumber2.default)(containerWidth)) {
throw new TypeError('Container width parameter value must be a number.');
}
const subjectWidth = (0, _stringWidth.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 (!(0, _isString2.default)(alignment)) {
throw new TypeError('Alignment parameter value must be a string.');
}
if (!alignments.includes(alignment)) {
throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');
}
if (subjectWidth === 0) {
return ' '.repeat(containerWidth);
}
const availableWidth = containerWidth - subjectWidth;
if (alignment === 'left') {
return alignLeft(subject, availableWidth);
}
if (alignment === 'right') {
return alignRight(subject, availableWidth);
}
return alignCenter(subject, availableWidth);
const subjectWidth = string_width_1.default(subject);
if (subjectWidth === containerWidth) {
return subject;
}
if (subjectWidth > containerWidth) {
throw new Error('Subject parameter value width cannot be greater than the container width.');
}
if (subjectWidth === 0) {
return ' '.repeat(containerWidth);
}
const availableWidth = containerWidth - subjectWidth;
if (alignment === 'left') {
return alignLeft(subject, availableWidth);
}
if (alignment === 'right') {
return alignRight(subject, availableWidth);
}
if (alignment === 'justify') {
return alignJustify(subject, availableWidth);
}
return alignCenter(subject, availableWidth);
};
var _default = alignString;
exports.default = _default;
//# sourceMappingURL=alignString.js.map
exports.alignString = alignString;

View file

@ -1,96 +0,0 @@
import _ from 'lodash';
import stringWidth from 'string-width';
const alignments = [
'left',
'right',
'center'
];
/**
* @param {string} subject
* @param {number} width
* @returns {string}
*/
const alignLeft = (subject, width) => {
return subject + ' '.repeat(width);
};
/**
* @param {string} subject
* @param {number} width
* @returns {string}
*/
const alignRight = (subject, width) => {
return ' '.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 ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth);
} else {
halfWidth = Math.floor(halfWidth);
return ' '.repeat(halfWidth) + subject + ' '.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}
*/
export default (subject, containerWidth, alignment) => {
if (!_.isString(subject)) {
throw new TypeError('Subject parameter value must be a string.');
}
if (!_.isNumber(containerWidth)) {
throw new TypeError('Container width parameter value must be a number.');
}
const subjectWidth = stringWidth(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 (!_.isString(alignment)) {
throw new TypeError('Alignment parameter value must be a string.');
}
if (!alignments.includes(alignment)) {
throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');
}
if (subjectWidth === 0) {
return ' '.repeat(containerWidth);
}
const availableWidth = containerWidth - subjectWidth;
if (alignment === 'left') {
return alignLeft(subject, availableWidth);
}
if (alignment === 'right') {
return alignRight(subject, availableWidth);
}
return alignCenter(subject, availableWidth);
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/alignString.js"],"names":["alignments","alignLeft","subject","width","repeat","alignRight","alignCenter","halfWidth","Math","floor","containerWidth","alignment","TypeError","subjectWidth","Error","includes","availableWidth"],"mappings":";;;;;;;;;;;AACA;;;;AAEA,MAAMA,UAAU,GAAG,CACjB,MADiB,EAEjB,OAFiB,EAGjB,QAHiB,CAAnB;AAMA;;;;;;AAKA,MAAMC,SAAS,GAAG,CAACC,OAAD,EAAUC,KAAV,KAAoB;AACpC,SAAOD,OAAO,GAAG,IAAIE,MAAJ,CAAWD,KAAX,CAAjB;AACD,CAFD;AAIA;;;;;;;AAKA,MAAME,UAAU,GAAG,CAACH,OAAD,EAAUC,KAAV,KAAoB;AACrC,SAAO,IAAIC,MAAJ,CAAWD,KAAX,IAAoBD,OAA3B;AACD,CAFD;AAIA;;;;;;;AAKA,MAAMI,WAAW,GAAG,CAACJ,OAAD,EAAUC,KAAV,KAAoB;AACtC,MAAII,SAAJ;AAEAA,EAAAA,SAAS,GAAGJ,KAAK,GAAG,CAApB;;AAEA,MAAII,SAAS,GAAG,CAAZ,KAAkB,CAAtB,EAAyB;AACvB,WAAO,IAAIH,MAAJ,CAAWG,SAAX,IAAwBL,OAAxB,GAAkC,IAAIE,MAAJ,CAAWG,SAAX,CAAzC;AACD,GAFD,MAEO;AACLA,IAAAA,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWF,SAAX,CAAZ;AAEA,WAAO,IAAIH,MAAJ,CAAWG,SAAX,IAAwBL,OAAxB,GAAkC,IAAIE,MAAJ,CAAWG,SAAS,GAAG,CAAvB,CAAzC;AACD;AACF,CAZD;AAcA;;;;;;;;;;;qBASgBL,O,EAASQ,c,EAAgBC,S,KAAc;AACrD,MAAI,CAAC,wBAAWT,OAAX,CAAL,EAA0B;AACxB,UAAM,IAAIU,SAAJ,CAAc,2CAAd,CAAN;AACD;;AAED,MAAI,CAAC,wBAAWF,cAAX,CAAL,EAAiC;AAC/B,UAAM,IAAIE,SAAJ,CAAc,mDAAd,CAAN;AACD;;AAED,QAAMC,YAAY,GAAG,0BAAYX,OAAZ,CAArB;;AAEA,MAAIW,YAAY,GAAGH,cAAnB,EAAmC;AACjC;AAEA,UAAM,IAAII,KAAJ,CAAU,2EAAV,CAAN;AACD;;AAED,MAAI,CAAC,wBAAWH,SAAX,CAAL,EAA4B;AAC1B,UAAM,IAAIC,SAAJ,CAAc,6CAAd,CAAN;AACD;;AAED,MAAI,CAACZ,UAAU,CAACe,QAAX,CAAoBJ,SAApB,CAAL,EAAqC;AACnC,UAAM,IAAIG,KAAJ,CAAU,4FAAV,CAAN;AACD;;AAED,MAAID,YAAY,KAAK,CAArB,EAAwB;AACtB,WAAO,IAAIT,MAAJ,CAAWM,cAAX,CAAP;AACD;;AAED,QAAMM,cAAc,GAAGN,cAAc,GAAGG,YAAxC;;AAEA,MAAIF,SAAS,KAAK,MAAlB,EAA0B;AACxB,WAAOV,SAAS,CAACC,OAAD,EAAUc,cAAV,CAAhB;AACD;;AAED,MAAIL,SAAS,KAAK,OAAlB,EAA2B;AACzB,WAAON,UAAU,CAACH,OAAD,EAAUc,cAAV,CAAjB;AACD;;AAED,SAAOV,WAAW,CAACJ,OAAD,EAAUc,cAAV,CAAlB;AACD,C","sourcesContent":["import _ from 'lodash';\nimport stringWidth from 'string-width';\n\nconst alignments = [\n 'left',\n 'right',\n 'center'\n];\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignLeft = (subject, width) => {\n return subject + ' '.repeat(width);\n};\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignRight = (subject, width) => {\n return ' '.repeat(width) + subject;\n};\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignCenter = (subject, width) => {\n let halfWidth;\n\n halfWidth = width / 2;\n\n if (halfWidth % 2 === 0) {\n return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth);\n } else {\n halfWidth = Math.floor(halfWidth);\n\n return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1);\n }\n};\n\n/**\n * Pads a string to the left and/or right to position the subject\n * text in a desired alignment within a container.\n *\n * @param {string} subject\n * @param {number} containerWidth\n * @param {string} alignment One of the valid options (left, right, center).\n * @returns {string}\n */\nexport default (subject, containerWidth, alignment) => {\n if (!_.isString(subject)) {\n throw new TypeError('Subject parameter value must be a string.');\n }\n\n if (!_.isNumber(containerWidth)) {\n throw new TypeError('Container width parameter value must be a number.');\n }\n\n const subjectWidth = stringWidth(subject);\n\n if (subjectWidth > containerWidth) {\n // console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject);\n\n throw new Error('Subject parameter value width cannot be greater than the container width.');\n }\n\n if (!_.isString(alignment)) {\n throw new TypeError('Alignment parameter value must be a string.');\n }\n\n if (!alignments.includes(alignment)) {\n throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');\n }\n\n if (subjectWidth === 0) {\n return ' '.repeat(containerWidth);\n }\n\n const availableWidth = containerWidth - subjectWidth;\n\n if (alignment === 'left') {\n return alignLeft(subject, availableWidth);\n }\n\n if (alignment === 'right') {\n return alignRight(subject, availableWidth);\n }\n\n return alignCenter(subject, availableWidth);\n};\n"],"file":"alignString.js"}

2
node_modules/table/dist/alignTableData.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
import type { BaseConfig, Row } from './types/internal';
export declare const alignTableData: (rows: Row[], config: BaseConfig) => Row[];

View file

@ -1,35 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _stringWidth = _interopRequireDefault(require("string-width"));
var _alignString = _interopRequireDefault(require("./alignString"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {table~row[]} rows
* @param {Object} config
* @returns {table~row[]}
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.alignTableData = void 0;
const alignString_1 = require("./alignString");
const alignTableData = (rows, config) => {
return rows.map(cells => {
return cells.map((value, index1) => {
const column = config.columns[index1];
if ((0, _stringWidth.default)(value) === column.width) {
return value;
} else {
return (0, _alignString.default)(value, column.width, column.alignment);
}
return rows.map((row) => {
return row.map((cell, cellIndex) => {
const { width, alignment } = config.columns[cellIndex];
return alignString_1.alignString(cell, width, alignment);
});
});
});
};
var _default = alignTableData;
exports.default = _default;
//# sourceMappingURL=alignTableData.js.map
exports.alignTableData = alignTableData;

View file

@ -1,21 +0,0 @@
import stringWidth from 'string-width';
import alignString from './alignString';
/**
* @param {table~row[]} rows
* @param {Object} config
* @returns {table~row[]}
*/
export default (rows, config) => {
return rows.map((cells) => {
return cells.map((value, index1) => {
const column = config.columns[index1];
if (stringWidth(value) === column.width) {
return value;
} else {
return alignString(value, column.width, column.alignment);
}
});
});
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/alignTableData.js"],"names":["rows","config","map","cells","value","index1","column","columns","width","alignment"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;wBAKgBA,I,EAAMC,M,KAAW;AAC/B,SAAOD,IAAI,CAACE,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAU,CAACE,KAAD,EAAQC,MAAR,KAAmB;AAClC,YAAMC,MAAM,GAAGL,MAAM,CAACM,OAAP,CAAeF,MAAf,CAAf;;AAEA,UAAI,0BAAYD,KAAZ,MAAuBE,MAAM,CAACE,KAAlC,EAAyC;AACvC,eAAOJ,KAAP;AACD,OAFD,MAEO;AACL,eAAO,0BAAYA,KAAZ,EAAmBE,MAAM,CAACE,KAA1B,EAAiCF,MAAM,CAACG,SAAxC,CAAP;AACD;AACF,KARM,CAAP;AASD,GAVM,CAAP;AAWD,C","sourcesContent":["import stringWidth from 'string-width';\nimport alignString from './alignString';\n\n/**\n * @param {table~row[]} rows\n * @param {Object} config\n * @returns {table~row[]}\n */\nexport default (rows, config) => {\n return rows.map((cells) => {\n return cells.map((value, index1) => {\n const column = config.columns[index1];\n\n if (stringWidth(value) === column.width) {\n return value;\n } else {\n return alignString(value, column.width, column.alignment);\n }\n });\n });\n};\n"],"file":"alignTableData.js"}

4
node_modules/table/dist/calculateCellHeight.d.ts generated vendored Normal file
View file

@ -0,0 +1,4 @@
/**
* Calculates height of cell content in regard to its width and word wrapping.
*/
export declare const calculateCellHeight: (value: string, columnWidth: number, useWrapWord?: boolean) => number;

View file

@ -1,38 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _isString2 = _interopRequireDefault(require("lodash/isString"));
var _wrapCell = _interopRequireDefault(require("./wrapCell"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateCellHeight = void 0;
const wrapCell_1 = require("./wrapCell");
/**
* @param {string} value
* @param {number} columnWidth
* @param {boolean} useWrapWord
* @returns {number}
* Calculates height of cell content in regard to its width and word wrapping.
*/
const calculateCellHeight = (value, columnWidth, useWrapWord = false) => {
if (!(0, _isString2.default)(value)) {
throw new TypeError('Value must be a string.');
}
if (!Number.isInteger(columnWidth)) {
throw new TypeError('Column width must be an integer.');
}
if (columnWidth < 1) {
throw new Error('Column width must be greater than 0.');
}
return (0, _wrapCell.default)(value, columnWidth, useWrapWord).length;
return wrapCell_1.wrapCell(value, columnWidth, useWrapWord).length;
};
var _default = calculateCellHeight;
exports.default = _default;
//# sourceMappingURL=calculateCellHeight.js.map
exports.calculateCellHeight = calculateCellHeight;

View file

@ -1,24 +0,0 @@
import _ from 'lodash';
import wrapCell from './wrapCell';
/**
* @param {string} value
* @param {number} columnWidth
* @param {boolean} useWrapWord
* @returns {number}
*/
export default (value, columnWidth, useWrapWord = false) => {
if (!_.isString(value)) {
throw new TypeError('Value must be a string.');
}
if (!Number.isInteger(columnWidth)) {
throw new TypeError('Column width must be an integer.');
}
if (columnWidth < 1) {
throw new Error('Column width must be greater than 0.');
}
return wrapCell(value, columnWidth, useWrapWord).length;
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/calculateCellHeight.js"],"names":["value","columnWidth","useWrapWord","TypeError","Number","isInteger","Error","length"],"mappings":";;;;;;;;;AACA;;;;AAEA;;;;;;6BAMgBA,K,EAAOC,W,EAAaC,WAAW,GAAG,K,KAAU;AAC1D,MAAI,CAAC,wBAAWF,KAAX,CAAL,EAAwB;AACtB,UAAM,IAAIG,SAAJ,CAAc,yBAAd,CAAN;AACD;;AAED,MAAI,CAACC,MAAM,CAACC,SAAP,CAAiBJ,WAAjB,CAAL,EAAoC;AAClC,UAAM,IAAIE,SAAJ,CAAc,kCAAd,CAAN;AACD;;AAED,MAAIF,WAAW,GAAG,CAAlB,EAAqB;AACnB,UAAM,IAAIK,KAAJ,CAAU,sCAAV,CAAN;AACD;;AAED,SAAO,uBAASN,KAAT,EAAgBC,WAAhB,EAA6BC,WAA7B,EAA0CK,MAAjD;AACD,C","sourcesContent":["import _ from 'lodash';\nimport wrapCell from './wrapCell';\n\n/**\n * @param {string} value\n * @param {number} columnWidth\n * @param {boolean} useWrapWord\n * @returns {number}\n */\nexport default (value, columnWidth, useWrapWord = false) => {\n if (!_.isString(value)) {\n throw new TypeError('Value must be a string.');\n }\n\n if (!Number.isInteger(columnWidth)) {\n throw new TypeError('Column width must be an integer.');\n }\n\n if (columnWidth < 1) {\n throw new Error('Column width must be greater than 0.');\n }\n\n return wrapCell(value, columnWidth, useWrapWord).length;\n};\n"],"file":"calculateCellHeight.js"}

View file

@ -1,28 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _stringWidth = _interopRequireDefault(require("string-width"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Calculates width of each cell contents.
*
* @param {string[]} cells
* @returns {number[]}
*/
const calculateCellWidthIndex = cells => {
return cells.map(value => {
return Math.max(...value.split('\n').map(line => {
return (0, _stringWidth.default)(line);
}));
});
};
var _default = calculateCellWidthIndex;
exports.default = _default;
//# sourceMappingURL=calculateCellWidthIndex.js.map

View file

@ -1,17 +0,0 @@
import stringWidth from 'string-width';
/**
* Calculates width of each cell contents.
*
* @param {string[]} cells
* @returns {number[]}
*/
export default (cells) => {
return cells.map((value) => {
return Math.max(
...value.split('\n').map((line) => {
return stringWidth(line);
})
);
});
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/calculateCellWidthIndex.js"],"names":["cells","map","value","Math","max","split","line"],"mappings":";;;;;;;AAAA;;;;AAEA;;;;;;gCAMgBA,K,IAAU;AACxB,SAAOA,KAAK,CAACC,GAAN,CAAWC,KAAD,IAAW;AAC1B,WAAOC,IAAI,CAACC,GAAL,CACL,GAAGF,KAAK,CAACG,KAAN,CAAY,IAAZ,EAAkBJ,GAAlB,CAAuBK,IAAD,IAAU;AACjC,aAAO,0BAAYA,IAAZ,CAAP;AACD,KAFE,CADE,CAAP;AAKD,GANM,CAAP;AAOD,C","sourcesContent":["import stringWidth from 'string-width';\n\n/**\n * Calculates width of each cell contents.\n *\n * @param {string[]} cells\n * @returns {number[]}\n */\nexport default (cells) => {\n return cells.map((value) => {\n return Math.max(\n ...value.split('\\n').map((line) => {\n return stringWidth(line);\n })\n );\n });\n};\n"],"file":"calculateCellWidthIndex.js"}

5
node_modules/table/dist/calculateCellWidths.d.ts generated vendored Normal file
View file

@ -0,0 +1,5 @@
import type { Cell } from './types/internal';
/**
* Calculates width of each cell contents in a row.
*/
export declare const calculateCellWidths: (cells: Cell[]) => number[];

16
node_modules/table/dist/calculateCellWidths.js generated vendored Normal file
View file

@ -0,0 +1,16 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateCellWidths = void 0;
const string_width_1 = __importDefault(require("string-width"));
/**
* Calculates width of each cell contents in a row.
*/
const calculateCellWidths = (cells) => {
return cells.map((cell) => {
return Math.max(...cell.split('\n').map(string_width_1.default));
});
};
exports.calculateCellWidths = calculateCellWidths;

6
node_modules/table/dist/calculateColumnWidths.d.ts generated vendored Normal file
View file

@ -0,0 +1,6 @@
import type { Row } from './types/internal';
declare const _default: (rows: Row[]) => number[];
/**
* Produces an array of values that describe the largest value length (width) in every column.
*/
export default _default;

16
node_modules/table/dist/calculateColumnWidths.js generated vendored Normal file
View file

@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const calculateCellWidths_1 = require("./calculateCellWidths");
/**
* Produces an array of values that describe the largest value length (width) in every column.
*/
exports.default = (rows) => {
const columnWidths = new Array(rows[0].length).fill(0);
rows.forEach((row) => {
const cellWidths = calculateCellWidths_1.calculateCellWidths(row);
cellWidths.forEach((cellWidth, cellIndex) => {
columnWidths[cellIndex] = Math.max(columnWidths[cellIndex], cellWidth);
});
});
return columnWidths;
};

View file

@ -1,37 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _calculateCellWidthIndex = _interopRequireDefault(require("./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[]}
*/
const calculateMaximumColumnWidthIndex = rows => {
if (!rows[0]) {
throw new Error('Dataset must have at least one row.');
}
const columns = new Array(rows[0].length).fill(0);
rows.forEach(row => {
const columnWidthIndex = (0, _calculateCellWidthIndex.default)(row);
columnWidthIndex.forEach((valueWidth, index0) => {
if (columns[index0] < valueWidth) {
columns[index0] = valueWidth;
}
});
});
return columns;
};
var _default = calculateMaximumColumnWidthIndex;
exports.default = _default;
//# sourceMappingURL=calculateMaximumColumnWidthIndex.js.map

View file

@ -1,27 +0,0 @@
import calculateCellWidthIndex from './calculateCellWidthIndex';
/**
* Produces an array of values that describe the largest value length (width) in every column.
*
* @param {Array[]} rows
* @returns {number[]}
*/
export default (rows) => {
if (!rows[0]) {
throw new Error('Dataset must have at least one row.');
}
const columns = new Array(rows[0].length).fill(0);
rows.forEach((row) => {
const columnWidthIndex = calculateCellWidthIndex(row);
columnWidthIndex.forEach((valueWidth, index0) => {
if (columns[index0] < valueWidth) {
columns[index0] = valueWidth;
}
});
});
return columns;
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/calculateMaximumColumnWidthIndex.js"],"names":["rows","Error","columns","Array","length","fill","forEach","row","columnWidthIndex","valueWidth","index0"],"mappings":";;;;;;;AAAA;;;;AAEA;;;;;;yCAMgBA,I,IAAS;AACvB,MAAI,CAACA,IAAI,CAAC,CAAD,CAAT,EAAc;AACZ,UAAM,IAAIC,KAAJ,CAAU,qCAAV,CAAN;AACD;;AAED,QAAMC,OAAO,GAAG,IAAIC,KAAJ,CAAUH,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAAlB,EAA0BC,IAA1B,CAA+B,CAA/B,CAAhB;AAEAL,EAAAA,IAAI,CAACM,OAAL,CAAcC,GAAD,IAAS;AACpB,UAAMC,gBAAgB,GAAG,sCAAwBD,GAAxB,CAAzB;AAEAC,IAAAA,gBAAgB,CAACF,OAAjB,CAAyB,CAACG,UAAD,EAAaC,MAAb,KAAwB;AAC/C,UAAIR,OAAO,CAACQ,MAAD,CAAP,GAAkBD,UAAtB,EAAkC;AAChCP,QAAAA,OAAO,CAACQ,MAAD,CAAP,GAAkBD,UAAlB;AACD;AACF,KAJD;AAKD,GARD;AAUA,SAAOP,OAAP;AACD,C","sourcesContent":["import calculateCellWidthIndex from './calculateCellWidthIndex';\n\n/**\n * Produces an array of values that describe the largest value length (width) in every column.\n *\n * @param {Array[]} rows\n * @returns {number[]}\n */\nexport default (rows) => {\n if (!rows[0]) {\n throw new Error('Dataset must have at least one row.');\n }\n\n const columns = new Array(rows[0].length).fill(0);\n\n rows.forEach((row) => {\n const columnWidthIndex = calculateCellWidthIndex(row);\n\n columnWidthIndex.forEach((valueWidth, index0) => {\n if (columns[index0] < valueWidth) {\n columns[index0] = valueWidth;\n }\n });\n });\n\n return columns;\n};\n"],"file":"calculateMaximumColumnWidthIndex.js"}

View file

@ -1,48 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _max2 = _interopRequireDefault(require("lodash/max"));
var _isBoolean2 = _interopRequireDefault(require("lodash/isBoolean"));
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
var _calculateCellHeight = _interopRequireDefault(require("./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[]}
*/
const calculateRowHeightIndex = (rows, config) => {
const tableWidth = rows[0].length;
const rowSpanIndex = [];
rows.forEach(cells => {
const cellHeightIndex = new Array(tableWidth).fill(1);
cells.forEach((value, index1) => {
if (!(0, _isNumber2.default)(config.columns[index1].width)) {
throw new TypeError('column[index].width must be a number.');
}
if (!(0, _isBoolean2.default)(config.columns[index1].wrapWord)) {
throw new TypeError('column[index].wrapWord must be a boolean.');
}
cellHeightIndex[index1] = (0, _calculateCellHeight.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
});
rowSpanIndex.push((0, _max2.default)(cellHeightIndex));
});
return rowSpanIndex;
};
var _default = calculateRowHeightIndex;
exports.default = _default;
//# sourceMappingURL=calculateRowHeightIndex.js.map

View file

@ -1,35 +0,0 @@
import _ from 'lodash';
import calculateCellHeight from './calculateCellHeight';
/**
* Calculates the vertical row span index.
*
* @param {Array[]} rows
* @param {Object} config
* @returns {number[]}
*/
export default (rows, config) => {
const tableWidth = rows[0].length;
const rowSpanIndex = [];
rows.forEach((cells) => {
const cellHeightIndex = new Array(tableWidth).fill(1);
cells.forEach((value, index1) => {
if (!_.isNumber(config.columns[index1].width)) {
throw new TypeError('column[index].width must be a number.');
}
if (!_.isBoolean(config.columns[index1].wrapWord)) {
throw new TypeError('column[index].wrapWord must be a boolean.');
}
cellHeightIndex[index1] = calculateCellHeight(value, config.columns[index1].width, config.columns[index1].wrapWord);
});
rowSpanIndex.push(_.max(cellHeightIndex));
});
return rowSpanIndex;
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/calculateRowHeightIndex.js"],"names":["rows","config","tableWidth","length","rowSpanIndex","forEach","cells","cellHeightIndex","Array","fill","value","index1","columns","width","TypeError","wrapWord","push"],"mappings":";;;;;;;;;;;;;AACA;;;;AAEA;;;;;;;iCAOgBA,I,EAAMC,M,KAAW;AAC/B,QAAMC,UAAU,GAAGF,IAAI,CAAC,CAAD,CAAJ,CAAQG,MAA3B;AAEA,QAAMC,YAAY,GAAG,EAArB;AAEAJ,EAAAA,IAAI,CAACK,OAAL,CAAcC,KAAD,IAAW;AACtB,UAAMC,eAAe,GAAG,IAAIC,KAAJ,CAAUN,UAAV,EAAsBO,IAAtB,CAA2B,CAA3B,CAAxB;AAEAH,IAAAA,KAAK,CAACD,OAAN,CAAc,CAACK,KAAD,EAAQC,MAAR,KAAmB;AAC/B,UAAI,CAAC,wBAAWV,MAAM,CAACW,OAAP,CAAeD,MAAf,EAAuBE,KAAlC,CAAL,EAA+C;AAC7C,cAAM,IAAIC,SAAJ,CAAc,uCAAd,CAAN;AACD;;AAED,UAAI,CAAC,yBAAYb,MAAM,CAACW,OAAP,CAAeD,MAAf,EAAuBI,QAAnC,CAAL,EAAmD;AACjD,cAAM,IAAID,SAAJ,CAAc,2CAAd,CAAN;AACD;;AAEDP,MAAAA,eAAe,CAACI,MAAD,CAAf,GAA0B,kCAAoBD,KAApB,EAA2BT,MAAM,CAACW,OAAP,CAAeD,MAAf,EAAuBE,KAAlD,EAAyDZ,MAAM,CAACW,OAAP,CAAeD,MAAf,EAAuBI,QAAhF,CAA1B;AACD,KAVD;AAYAX,IAAAA,YAAY,CAACY,IAAb,CAAkB,mBAAMT,eAAN,CAAlB;AACD,GAhBD;AAkBA,SAAOH,YAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport calculateCellHeight from './calculateCellHeight';\n\n/**\n * Calculates the vertical row span index.\n *\n * @param {Array[]} rows\n * @param {Object} config\n * @returns {number[]}\n */\nexport default (rows, config) => {\n const tableWidth = rows[0].length;\n\n const rowSpanIndex = [];\n\n rows.forEach((cells) => {\n const cellHeightIndex = new Array(tableWidth).fill(1);\n\n cells.forEach((value, index1) => {\n if (!_.isNumber(config.columns[index1].width)) {\n throw new TypeError('column[index].width must be a number.');\n }\n\n if (!_.isBoolean(config.columns[index1].wrapWord)) {\n throw new TypeError('column[index].wrapWord must be a boolean.');\n }\n\n cellHeightIndex[index1] = calculateCellHeight(value, config.columns[index1].width, config.columns[index1].wrapWord);\n });\n\n rowSpanIndex.push(_.max(cellHeightIndex));\n });\n\n return rowSpanIndex;\n};\n"],"file":"calculateRowHeightIndex.js"}

5
node_modules/table/dist/calculateRowHeights.d.ts generated vendored Normal file
View file

@ -0,0 +1,5 @@
import type { BaseConfig, Row } from './types/internal';
/**
* Produces an array of values that describe the largest value length (height) in every row.
*/
export declare const calculateRowHeights: (rows: Row[], config: BaseConfig) => number[];

18
node_modules/table/dist/calculateRowHeights.js generated vendored Normal file
View file

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateRowHeights = void 0;
const calculateCellHeight_1 = require("./calculateCellHeight");
/**
* Produces an array of values that describe the largest value length (height) in every row.
*/
const calculateRowHeights = (rows, config) => {
return rows.map((row) => {
let rowHeight = 1;
row.forEach((cell, cellIndex) => {
const cellHeight = calculateCellHeight_1.calculateCellHeight(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord);
rowHeight = Math.max(rowHeight, cellHeight);
});
return rowHeight;
});
};
exports.calculateRowHeights = calculateRowHeights;

2
node_modules/table/dist/createStream.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
import type { StreamUserConfig, WritableStream } from './types/api';
export declare const createStream: (userConfig: StreamUserConfig) => WritableStream;

View file

@ -1,132 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _mapValues2 = _interopRequireDefault(require("lodash/mapValues"));
var _values2 = _interopRequireDefault(require("lodash/values"));
var _trimEnd2 = _interopRequireDefault(require("lodash/trimEnd"));
var _makeStreamConfig = _interopRequireDefault(require("./makeStreamConfig"));
var _drawRow = _interopRequireDefault(require("./drawRow"));
var _drawBorder = require("./drawBorder");
var _stringifyTableData = _interopRequireDefault(require("./stringifyTableData"));
var _truncateTableData = _interopRequireDefault(require("./truncateTableData"));
var _mapDataUsingRowHeightIndex = _interopRequireDefault(require("./mapDataUsingRowHeightIndex"));
var _alignTableData = _interopRequireDefault(require("./alignTableData"));
var _padTableData = _interopRequireDefault(require("./padTableData"));
var _calculateRowHeightIndex = _interopRequireDefault(require("./calculateRowHeightIndex"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {Array} data
* @param {Object} config
* @returns {Array}
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.createStream = void 0;
const alignTableData_1 = require("./alignTableData");
const calculateRowHeights_1 = require("./calculateRowHeights");
const drawBorder_1 = require("./drawBorder");
const drawRow_1 = require("./drawRow");
const makeStreamConfig_1 = require("./makeStreamConfig");
const mapDataUsingRowHeights_1 = require("./mapDataUsingRowHeights");
const padTableData_1 = require("./padTableData");
const stringifyTableData_1 = require("./stringifyTableData");
const truncateTableData_1 = require("./truncateTableData");
const prepareData = (data, config) => {
let rows;
rows = (0, _stringifyTableData.default)(data);
rows = (0, _truncateTableData.default)(data, config);
const rowHeightIndex = (0, _calculateRowHeightIndex.default)(rows, config);
rows = (0, _mapDataUsingRowHeightIndex.default)(rows, rowHeightIndex, config);
rows = (0, _alignTableData.default)(rows, config);
rows = (0, _padTableData.default)(rows, config);
return rows;
let rows = stringifyTableData_1.stringifyTableData(data);
rows = truncateTableData_1.truncateTableData(rows, config);
const rowHeights = calculateRowHeights_1.calculateRowHeights(rows, config);
rows = mapDataUsingRowHeights_1.mapDataUsingRowHeights(rows, rowHeights, config);
rows = alignTableData_1.alignTableData(rows, config);
rows = padTableData_1.padTableData(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 = rows.map(literalRow => {
return (0, _drawRow.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 = (0, _trimEnd2.default)(output);
process.stdout.write(output);
const create = (row, columnWidths, config) => {
const rows = prepareData([row], config);
const body = rows.map((literalRow) => {
return drawRow_1.drawRow(literalRow, config);
}).join('');
let output;
output = '';
output += drawBorder_1.drawBorderTop(columnWidths, config);
output += body;
output += drawBorder_1.drawBorderBottom(columnWidths, config);
output = output.trimEnd();
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 = rows.map(literalRow => {
return (0, _drawRow.default)(literalRow, config.border);
}).join('');
let output = '';
const bottom = (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border);
if (bottom !== '\n') {
output = '\r\u001B[K';
}
output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config.border);
output += body;
output += bottom;
output = (0, _trimEnd2.default)(output);
process.stdout.write(output);
};
/**
* @param {Object} userConfig
* @returns {Object}
*/
const createStream = (userConfig = {}) => {
const config = (0, _makeStreamConfig.default)(userConfig); // @todo Use 'Object.values' when Node.js v6 support is dropped.
const columnWidthIndex = (0, _values2.default)((0, _mapValues2.default)(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);
}
const append = (row, columnWidths, config) => {
const rows = prepareData([row], config);
const body = rows.map((literalRow) => {
return drawRow_1.drawRow(literalRow, config);
}).join('');
let output = '';
const bottom = drawBorder_1.drawBorderBottom(columnWidths, config);
if (bottom !== '\n') {
output = '\r\u001B[K';
}
};
output += drawBorder_1.drawBorderJoin(columnWidths, config);
output += body;
output += bottom;
output = output.trimEnd();
process.stdout.write(output);
};
var _default = createStream;
exports.default = _default;
//# sourceMappingURL=createStream.js.map
const createStream = (userConfig) => {
const config = makeStreamConfig_1.makeStreamConfig(userConfig);
const columnWidths = Object.values(config.columns).map((column) => {
return column.width + column.paddingLeft + column.paddingRight;
});
let empty = true;
return {
write: (row) => {
if (row.length !== config.columnCount) {
throw new Error('Row cell count does not match the config.columnCount.');
}
if (empty) {
empty = false;
create(row, columnWidths, config);
}
else {
append(row, columnWidths, config);
}
},
};
};
exports.createStream = createStream;

View file

@ -1,127 +0,0 @@
import _ from 'lodash';
import makeStreamConfig from './makeStreamConfig';
import drawRow from './drawRow';
import {
drawBorderBottom,
drawBorderJoin,
drawBorderTop
} from './drawBorder';
import stringifyTableData from './stringifyTableData';
import truncateTableData from './truncateTableData';
import mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex';
import alignTableData from './alignTableData';
import padTableData from './padTableData';
import calculateRowHeightIndex from './calculateRowHeightIndex';
/**
* @param {Array} data
* @param {Object} config
* @returns {Array}
*/
const prepareData = (data, config) => {
let rows;
rows = stringifyTableData(data);
rows = truncateTableData(data, config);
const rowHeightIndex = calculateRowHeightIndex(rows, config);
rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config);
rows = alignTableData(rows, config);
rows = padTableData(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 = rows.map((literalRow) => {
return drawRow(literalRow, config.border);
}).join('');
let output;
output = '';
output += drawBorderTop(columnWidthIndex, config.border);
output += body;
output += drawBorderBottom(columnWidthIndex, config.border);
output = _.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 = rows.map((literalRow) => {
return drawRow(literalRow, config.border);
}).join('');
let output = '';
const bottom = drawBorderBottom(columnWidthIndex, config.border);
if (bottom !== '\n') {
output = '\r\u001B[K';
}
output += drawBorderJoin(columnWidthIndex, config.border);
output += body;
output += bottom;
output = _.trimEnd(output);
process.stdout.write(output);
};
/**
* @param {Object} userConfig
* @returns {Object}
*/
export default (userConfig = {}) => {
const config = makeStreamConfig(userConfig);
// @todo Use 'Object.values' when Node.js v6 support is dropped.
const columnWidthIndex = _.values(_.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);
}
}
};
};

File diff suppressed because one or more lines are too long

26
node_modules/table/dist/drawBorder.d.ts generated vendored Normal file
View file

@ -0,0 +1,26 @@
import type { DrawVerticalLine } from './types/api';
import type { TableConfig, SeparatorGetter, TopBorderConfig, JoinBorderConfig, BottomBorderConfig } from './types/internal';
declare type Separator = {
readonly left: string;
readonly right: string;
readonly body: string;
readonly join: string;
};
declare const drawBorder: (columnWidths: number[], config: {
separator: Separator;
drawVerticalLine: DrawVerticalLine;
}) => string;
declare const drawBorderTop: (columnWidths: number[], config: {
border: TopBorderConfig;
drawVerticalLine: DrawVerticalLine;
}) => string;
declare const drawBorderJoin: (columnWidths: number[], config: {
border: JoinBorderConfig;
drawVerticalLine: DrawVerticalLine;
}) => string;
declare const drawBorderBottom: (columnWidths: number[], config: {
border: BottomBorderConfig;
drawVerticalLine: DrawVerticalLine;
}) => string;
export declare const createTableBorderGetter: (columnWidths: number[], config: TableConfig) => SeparatorGetter;
export { drawBorder, drawBorderBottom, drawBorderJoin, drawBorderTop, };

192
node_modules/table/dist/drawBorder.js generated vendored
View file

@ -1,110 +1,100 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = void 0;
/**
* @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 = columnSizeIndex.map(size => {
return parts.body.repeat(size);
}).join(parts.join);
return parts.left + columns + parts.right + '\n';
Object.defineProperty(exports, "__esModule", { value: true });
exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = exports.createTableBorderGetter = void 0;
const drawContent_1 = require("./drawContent");
const drawBorder = (columnWidths, config) => {
const { separator, drawVerticalLine } = config;
const columns = columnWidths.map((size) => {
return config.separator.body.repeat(size);
});
return drawContent_1.drawContent(columns, {
drawSeparator: drawVerticalLine,
separatorGetter: (index, columnCount) => {
if (index === 0) {
return separator.left;
}
if (index === columnCount) {
return separator.right;
}
return separator.join;
},
}) + '\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}
*/
exports.drawBorder = drawBorder;
const drawBorderTop = (columnSizeIndex, parts) => {
const border = drawBorder(columnSizeIndex, {
body: parts.topBody,
join: parts.topJoin,
left: parts.topLeft,
right: parts.topRight
});
if (border === '\n') {
return '';
}
return border;
const drawBorderTop = (columnWidths, config) => {
const result = drawBorder(columnWidths, {
...config,
separator: {
body: config.border.topBody,
join: config.border.topJoin,
left: config.border.topLeft,
right: config.border.topRight,
},
});
if (result === '\n') {
return '';
}
return result;
};
/**
* @typedef drawBorderJoin~parts
* @property {string} joinLeft
* @property {string} joinRight
* @property {string} joinBody
* @property {string} joinJoin
*/
/**
* @param {number[]} columnSizeIndex
* @param {drawBorderJoin~parts} parts
* @returns {string}
*/
exports.drawBorderTop = drawBorderTop;
const drawBorderJoin = (columnSizeIndex, parts) => {
return drawBorder(columnSizeIndex, {
body: parts.joinBody,
join: parts.joinJoin,
left: parts.joinLeft,
right: parts.joinRight
});
const drawBorderJoin = (columnWidths, config) => {
return drawBorder(columnWidths, {
...config,
separator: {
body: config.border.joinBody,
join: config.border.joinJoin,
left: config.border.joinLeft,
right: config.border.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}
*/
exports.drawBorderJoin = drawBorderJoin;
const drawBorderBottom = (columnSizeIndex, parts) => {
return drawBorder(columnSizeIndex, {
body: parts.bottomBody,
join: parts.bottomJoin,
left: parts.bottomLeft,
right: parts.bottomRight
});
const drawBorderBottom = (columnWidths, config) => {
return drawBorder(columnWidths, {
...config,
separator: {
body: config.border.bottomBody,
join: config.border.bottomJoin,
left: config.border.bottomLeft,
right: config.border.bottomRight,
},
});
};
exports.drawBorderBottom = drawBorderBottom;
//# sourceMappingURL=drawBorder.js.map
const createTableBorderGetter = (columnWidths, config) => {
return (index, size) => {
if (!config.header) {
if (index === 0) {
return drawBorderTop(columnWidths, config);
}
if (index === size) {
return drawBorderBottom(columnWidths, config);
}
return drawBorderJoin(columnWidths, config);
}
// Deal with the header
if (index === 0) {
return drawBorderTop(columnWidths, {
...config,
border: {
...config.border,
topJoin: config.border.topBody,
},
});
}
if (index === 1) {
return drawBorderJoin(columnWidths, {
...config,
border: {
...config.border,
joinJoin: config.border.headerJoin,
},
});
}
if (index === size) {
return drawBorderBottom(columnWidths, config);
}
return drawBorderJoin(columnWidths, config);
};
};
exports.createTableBorderGetter = createTableBorderGetter;

View file

@ -1,101 +0,0 @@
/**
* @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 = columnSizeIndex
.map((size) => {
return parts.body.repeat(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) => {
const border = drawBorder(columnSizeIndex, {
body: parts.topBody,
join: parts.topJoin,
left: parts.topLeft,
right: parts.topRight
});
if (border === '\n') {
return '';
}
return border;
};
/**
* @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
});
};
export {
drawBorder,
drawBorderBottom,
drawBorderJoin,
drawBorderTop
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/drawBorder.js"],"names":["drawBorder","columnSizeIndex","parts","columns","map","size","body","repeat","join","left","right","drawBorderTop","border","topBody","topJoin","topLeft","topRight","drawBorderJoin","joinBody","joinJoin","joinLeft","joinRight","drawBorderBottom","bottomBody","bottomJoin","bottomLeft","bottomRight"],"mappings":";;;;;;;AAAA;;;;;;;;AAQA;;;;;AAKA,MAAMA,UAAU,GAAG,CAACC,eAAD,EAAkBC,KAAlB,KAA4B;AAC7C,QAAMC,OAAO,GAAGF,eAAe,CAC5BG,GADa,CACRC,IAAD,IAAU;AACb,WAAOH,KAAK,CAACI,IAAN,CAAWC,MAAX,CAAkBF,IAAlB,CAAP;AACD,GAHa,EAIbG,IAJa,CAIRN,KAAK,CAACM,IAJE,CAAhB;AAMA,SAAON,KAAK,CAACO,IAAN,GAAaN,OAAb,GAAuBD,KAAK,CAACQ,KAA7B,GAAqC,IAA5C;AACD,CARD;AAUA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMC,aAAa,GAAG,CAACV,eAAD,EAAkBC,KAAlB,KAA4B;AAChD,QAAMU,MAAM,GAAGZ,UAAU,CAACC,eAAD,EAAkB;AACzCK,IAAAA,IAAI,EAAEJ,KAAK,CAACW,OAD6B;AAEzCL,IAAAA,IAAI,EAAEN,KAAK,CAACY,OAF6B;AAGzCL,IAAAA,IAAI,EAAEP,KAAK,CAACa,OAH6B;AAIzCL,IAAAA,KAAK,EAAER,KAAK,CAACc;AAJ4B,GAAlB,CAAzB;;AAOA,MAAIJ,MAAM,KAAK,IAAf,EAAqB;AACnB,WAAO,EAAP;AACD;;AAED,SAAOA,MAAP;AACD,CAbD;AAeA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMK,cAAc,GAAG,CAAChB,eAAD,EAAkBC,KAAlB,KAA4B;AACjD,SAAOF,UAAU,CAACC,eAAD,EAAkB;AACjCK,IAAAA,IAAI,EAAEJ,KAAK,CAACgB,QADqB;AAEjCV,IAAAA,IAAI,EAAEN,KAAK,CAACiB,QAFqB;AAGjCV,IAAAA,IAAI,EAAEP,KAAK,CAACkB,QAHqB;AAIjCV,IAAAA,KAAK,EAAER,KAAK,CAACmB;AAJoB,GAAlB,CAAjB;AAMD,CAPD;AASA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMC,gBAAgB,GAAG,CAACrB,eAAD,EAAkBC,KAAlB,KAA4B;AACnD,SAAOF,UAAU,CAACC,eAAD,EAAkB;AACjCK,IAAAA,IAAI,EAAEJ,KAAK,CAACqB,UADqB;AAEjCf,IAAAA,IAAI,EAAEN,KAAK,CAACsB,UAFqB;AAGjCf,IAAAA,IAAI,EAAEP,KAAK,CAACuB,UAHqB;AAIjCf,IAAAA,KAAK,EAAER,KAAK,CAACwB;AAJoB,GAAlB,CAAjB;AAMD,CAPD","sourcesContent":["/**\n * @typedef drawBorder~parts\n * @property {string} left\n * @property {string} right\n * @property {string} body\n * @property {string} join\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorder~parts} parts\n * @returns {string}\n */\nconst drawBorder = (columnSizeIndex, parts) => {\n const columns = columnSizeIndex\n .map((size) => {\n return parts.body.repeat(size);\n })\n .join(parts.join);\n\n return parts.left + columns + parts.right + '\\n';\n};\n\n/**\n * @typedef drawBorderTop~parts\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} topBody\n * @property {string} topJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderTop~parts} parts\n * @returns {string}\n */\nconst drawBorderTop = (columnSizeIndex, parts) => {\n const border = drawBorder(columnSizeIndex, {\n body: parts.topBody,\n join: parts.topJoin,\n left: parts.topLeft,\n right: parts.topRight\n });\n\n if (border === '\\n') {\n return '';\n }\n\n return border;\n};\n\n/**\n * @typedef drawBorderJoin~parts\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinBody\n * @property {string} joinJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderJoin~parts} parts\n * @returns {string}\n */\nconst drawBorderJoin = (columnSizeIndex, parts) => {\n return drawBorder(columnSizeIndex, {\n body: parts.joinBody,\n join: parts.joinJoin,\n left: parts.joinLeft,\n right: parts.joinRight\n });\n};\n\n/**\n * @typedef drawBorderBottom~parts\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} topBody\n * @property {string} topJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderBottom~parts} parts\n * @returns {string}\n */\nconst drawBorderBottom = (columnSizeIndex, parts) => {\n return drawBorder(columnSizeIndex, {\n body: parts.bottomBody,\n join: parts.bottomJoin,\n left: parts.bottomLeft,\n right: parts.bottomRight\n });\n};\n\nexport {\n drawBorder,\n drawBorderBottom,\n drawBorderJoin,\n drawBorderTop\n};\n"],"file":"drawBorder.js"}

9
node_modules/table/dist/drawContent.d.ts generated vendored Normal file
View file

@ -0,0 +1,9 @@
declare type SeparatorConfig = {
drawSeparator: (index: number, size: number) => boolean;
separatorGetter: (index: number, size: number) => string;
};
/**
* Shared function to draw horizontal borders, rows or the entire table
*/
export declare const drawContent: (contents: string[], separatorConfig: SeparatorConfig) => string;
export {};

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

@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.drawContent = void 0;
/**
* Shared function to draw horizontal borders, rows or the entire table
*/
const drawContent = (contents, separatorConfig) => {
const { separatorGetter, drawSeparator } = separatorConfig;
const contentSize = contents.length;
const result = [];
if (drawSeparator(0, contentSize)) {
result.push(separatorGetter(0, contentSize));
}
contents.forEach((content, contentIndex) => {
result.push(content);
// Only append the middle separator if the content is not the last
if (contentIndex + 1 < contentSize && drawSeparator(contentIndex + 1, contentSize)) {
result.push(separatorGetter(contentIndex + 1, contentSize));
}
});
if (drawSeparator(contentSize, contentSize)) {
result.push(separatorGetter(contentSize, contentSize));
}
return result.join('');
};
exports.drawContent = drawContent;

2
node_modules/table/dist/drawHeader.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
import type { TableConfig } from './types/internal';
export declare const drawHeader: (width: number, config: TableConfig) => string;

29
node_modules/table/dist/drawHeader.js generated vendored Normal file
View file

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.drawHeader = void 0;
const alignString_1 = require("./alignString");
const drawRow_1 = require("./drawRow");
const padTableData_1 = require("./padTableData");
const truncateTableData_1 = require("./truncateTableData");
const wrapCell_1 = require("./wrapCell");
const drawHeader = (width, config) => {
if (!config.header) {
throw new Error('Can not draw header without header configuration');
}
const { alignment, paddingRight, paddingLeft, wrapWord } = config.header;
let content = config.header.content;
content = truncateTableData_1.truncateString(content, config.header.truncate);
const headerLines = wrapCell_1.wrapCell(content, width, wrapWord);
return headerLines.map((headerLine) => {
let line = alignString_1.alignString(headerLine, width, alignment);
line = padTableData_1.padString(line, paddingLeft, paddingRight);
return drawRow_1.drawRow([line], {
...config,
drawVerticalLine: (index) => {
const columnCount = config.columns.length;
return config.drawVerticalLine(index === 0 ? 0 : columnCount, columnCount);
},
});
}).join('');
};
exports.drawHeader = drawHeader;

6
node_modules/table/dist/drawRow.d.ts generated vendored Normal file
View file

@ -0,0 +1,6 @@
import type { DrawVerticalLine } from './types/api';
import type { BodyBorderConfig, Row } from './types/internal';
export declare const drawRow: (row: Row, config: {
border: BodyBorderConfig;
drawVerticalLine: DrawVerticalLine;
}) => string;

42
node_modules/table/dist/drawRow.js generated vendored
View file

@ -1,26 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* @typedef {Object} drawRow~border
* @property {string} bodyLeft
* @property {string} bodyRight
* @property {string} bodyJoin
*/
/**
* @param {number[]} columns
* @param {drawRow~border} border
* @returns {string}
*/
const drawRow = (columns, border) => {
return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n';
Object.defineProperty(exports, "__esModule", { value: true });
exports.drawRow = void 0;
const drawContent_1 = require("./drawContent");
const drawRow = (row, config) => {
const { border, drawVerticalLine } = config;
return drawContent_1.drawContent(row, {
drawSeparator: drawVerticalLine,
separatorGetter: (index, columnCount) => {
if (index === 0) {
return border.bodyLeft;
}
if (index === columnCount) {
return border.bodyRight;
}
return border.bodyJoin;
},
}) + '\n';
};
var _default = drawRow;
exports.default = _default;
//# sourceMappingURL=drawRow.js.map
exports.drawRow = drawRow;

View file

@ -1,15 +0,0 @@
/**
* @typedef {Object} drawRow~border
* @property {string} bodyLeft
* @property {string} bodyRight
* @property {string} bodyJoin
*/
/**
* @param {number[]} columns
* @param {drawRow~border} border
* @returns {string}
*/
export default (columns, border) => {
return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n';
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/drawRow.js"],"names":["columns","border","bodyLeft","join","bodyJoin","bodyRight"],"mappings":";;;;;;;AAAA;;;;;;;AAOA;;;;;iBAKgBA,O,EAASC,M,KAAW;AAClC,SAAOA,MAAM,CAACC,QAAP,GAAkBF,OAAO,CAACG,IAAR,CAAaF,MAAM,CAACG,QAApB,CAAlB,GAAkDH,MAAM,CAACI,SAAzD,GAAqE,IAA5E;AACD,C","sourcesContent":["/**\n * @typedef {Object} drawRow~border\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n */\n\n/**\n * @param {number[]} columns\n * @param {drawRow~border} border\n * @returns {string}\n */\nexport default (columns, border) => {\n return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\\n';\n};\n"],"file":"drawRow.js"}

2
node_modules/table/dist/drawTable.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
import type { TableConfig, Row } from './types/internal';
export declare const drawTable: (rows: Row[], columnWidths: number[], rowHeights: number[], config: TableConfig) => string;

93
node_modules/table/dist/drawTable.js generated vendored
View file

@ -1,59 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _drawBorder = require("./drawBorder");
var _drawRow = _interopRequireDefault(require("./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
* @param {boolean} singleLine
* @returns {string}
*/
const drawTable = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine, singleLine) => {
let output;
let realRowIndex;
let rowHeight;
const rowCount = rows.length;
realRowIndex = 0;
output = '';
if (drawHorizontalLine(realRowIndex, rowCount)) {
output += (0, _drawBorder.drawBorderTop)(columnSizeIndex, border);
}
rows.forEach((row, index0) => {
output += (0, _drawRow.default)(row, border);
if (!rowHeight) {
rowHeight = rowSpanIndex[realRowIndex];
realRowIndex++;
}
rowHeight--;
if (!singleLine && 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;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _default = drawTable;
exports.default = _default;
//# sourceMappingURL=drawTable.js.map
Object.defineProperty(exports, "__esModule", { value: true });
exports.drawTable = void 0;
const string_width_1 = __importDefault(require("string-width"));
const drawBorder_1 = require("./drawBorder");
const drawContent_1 = require("./drawContent");
const drawHeader_1 = require("./drawHeader");
const drawRow_1 = require("./drawRow");
const utils_1 = require("./utils");
const drawTable = (rows, columnWidths, rowHeights, config) => {
const { drawHorizontalLine, singleLine, } = config;
const contents = utils_1.groupBySizes(rows, rowHeights).map((group) => {
return group.map((row) => {
return drawRow_1.drawRow(row, config);
}).join('');
});
if (config.header) {
// assume that topLeft/right border have width = 1
const headerWidth = string_width_1.default(drawRow_1.drawRow(rows[0], config)) - 2 -
config.header.paddingLeft - config.header.paddingRight;
const header = drawHeader_1.drawHeader(headerWidth, config);
contents.unshift(header);
}
return drawContent_1.drawContent(contents, {
drawSeparator: (index, size) => {
// Top/bottom border
if (index === 0 || index === size) {
return drawHorizontalLine(index, size);
}
return !singleLine && drawHorizontalLine(index, size);
},
separatorGetter: drawBorder_1.createTableBorderGetter(columnWidths, config),
});
};
exports.drawTable = drawTable;

View file

@ -1,53 +0,0 @@
import {
drawBorderTop,
drawBorderJoin,
drawBorderBottom
} from './drawBorder';
import drawRow from './drawRow';
/**
* @param {Array} rows
* @param {Object} border
* @param {Array} columnSizeIndex
* @param {Array} rowSpanIndex
* @param {Function} drawHorizontalLine
* @param {boolean} singleLine
* @returns {string}
*/
export default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine, singleLine) => {
let output;
let realRowIndex;
let rowHeight;
const rowCount = rows.length;
realRowIndex = 0;
output = '';
if (drawHorizontalLine(realRowIndex, rowCount)) {
output += drawBorderTop(columnSizeIndex, border);
}
rows.forEach((row, index0) => {
output += drawRow(row, border);
if (!rowHeight) {
rowHeight = rowSpanIndex[realRowIndex];
realRowIndex++;
}
rowHeight--;
if (!singleLine && rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {
output += drawBorderJoin(columnSizeIndex, border);
}
});
if (drawHorizontalLine(realRowIndex, rowCount)) {
output += drawBorderBottom(columnSizeIndex, border);
}
return output;
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/drawTable.js"],"names":["rows","border","columnSizeIndex","rowSpanIndex","drawHorizontalLine","singleLine","output","realRowIndex","rowHeight","rowCount","length","forEach","row","index0"],"mappings":";;;;;;;AAAA;;AAKA;;;;AAEA;;;;;;;;;mBASgBA,I,EAAMC,M,EAAQC,e,EAAiBC,Y,EAAcC,kB,EAAoBC,U,KAAe;AAC9F,MAAIC,MAAJ;AACA,MAAIC,YAAJ;AACA,MAAIC,SAAJ;AAEA,QAAMC,QAAQ,GAAGT,IAAI,CAACU,MAAtB;AAEAH,EAAAA,YAAY,GAAG,CAAf;AAEAD,EAAAA,MAAM,GAAG,EAAT;;AAEA,MAAIF,kBAAkB,CAACG,YAAD,EAAeE,QAAf,CAAtB,EAAgD;AAC9CH,IAAAA,MAAM,IAAI,+BAAcJ,eAAd,EAA+BD,MAA/B,CAAV;AACD;;AAEDD,EAAAA,IAAI,CAACW,OAAL,CAAa,CAACC,GAAD,EAAMC,MAAN,KAAiB;AAC5BP,IAAAA,MAAM,IAAI,sBAAQM,GAAR,EAAaX,MAAb,CAAV;;AAEA,QAAI,CAACO,SAAL,EAAgB;AACdA,MAAAA,SAAS,GAAGL,YAAY,CAACI,YAAD,CAAxB;AAEAA,MAAAA,YAAY;AACb;;AAEDC,IAAAA,SAAS;;AAET,QAAI,CAACH,UAAD,IAAeG,SAAS,KAAK,CAA7B,IAAkCK,MAAM,KAAKJ,QAAQ,GAAG,CAAxD,IAA6DL,kBAAkB,CAACG,YAAD,EAAeE,QAAf,CAAnF,EAA6G;AAC3GH,MAAAA,MAAM,IAAI,gCAAeJ,eAAf,EAAgCD,MAAhC,CAAV;AACD;AACF,GAdD;;AAgBA,MAAIG,kBAAkB,CAACG,YAAD,EAAeE,QAAf,CAAtB,EAAgD;AAC9CH,IAAAA,MAAM,IAAI,kCAAiBJ,eAAjB,EAAkCD,MAAlC,CAAV;AACD;;AAED,SAAOK,MAAP;AACD,C","sourcesContent":["import {\n drawBorderTop,\n drawBorderJoin,\n drawBorderBottom\n} from './drawBorder';\nimport drawRow from './drawRow';\n\n/**\n * @param {Array} rows\n * @param {Object} border\n * @param {Array} columnSizeIndex\n * @param {Array} rowSpanIndex\n * @param {Function} drawHorizontalLine\n * @param {boolean} singleLine\n * @returns {string}\n */\nexport default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine, singleLine) => {\n let output;\n let realRowIndex;\n let rowHeight;\n\n const rowCount = rows.length;\n\n realRowIndex = 0;\n\n output = '';\n\n if (drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderTop(columnSizeIndex, border);\n }\n\n rows.forEach((row, index0) => {\n output += drawRow(row, border);\n\n if (!rowHeight) {\n rowHeight = rowSpanIndex[realRowIndex];\n\n realRowIndex++;\n }\n\n rowHeight--;\n\n if (!singleLine && rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderJoin(columnSizeIndex, border);\n }\n });\n\n if (drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderBottom(columnSizeIndex, border);\n }\n\n return output;\n};\n"],"file":"drawTable.js"}

13
node_modules/table/dist/generated/validators.d.ts generated vendored Normal file
View file

@ -0,0 +1,13 @@
declare function validate43(data: any, { instancePath, parentData, parentDataProperty, rootData }?: {
instancePath?: string | undefined;
parentData: any;
parentDataProperty: any;
rootData?: any;
}): boolean;
declare function validate76(data: any, { instancePath, parentData, parentDataProperty, rootData }?: {
instancePath?: string | undefined;
parentData: any;
parentDataProperty: any;
rootData?: any;
}): boolean;
export { validate43 as _config_json, validate76 as _streamConfig_json };

2170
node_modules/table/dist/generated/validators.js generated vendored Normal file

File diff suppressed because it is too large Load diff

2
node_modules/table/dist/getBorderCharacters.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
import type { BorderConfig } from './types/api';
export declare const getBorderCharacters: (name: string) => BorderConfig;

View file

@ -1,119 +1,88 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/* 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}
*/
const getBorderCharacters = 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 + '".');
/* eslint-disable sort-keys-fix/sort-keys-fix */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBorderCharacters = void 0;
const getBorderCharacters = (name) => {
if (name === 'honeywell') {
return {
topBody: '═',
topJoin: '╤',
topLeft: '╔',
topRight: '╗',
bottomBody: '═',
bottomJoin: '╧',
bottomLeft: '╚',
bottomRight: '╝',
bodyLeft: '║',
bodyRight: '║',
bodyJoin: '│',
headerJoin: '┬',
joinBody: '─',
joinLeft: '╟',
joinRight: '╢',
joinJoin: '┼',
};
}
if (name === 'norc') {
return {
topBody: '─',
topJoin: '┬',
topLeft: '┌',
topRight: '┐',
bottomBody: '─',
bottomJoin: '┴',
bottomLeft: '└',
bottomRight: '┘',
bodyLeft: '│',
bodyRight: '│',
bodyJoin: '│',
headerJoin: '┬',
joinBody: '─',
joinLeft: '├',
joinRight: '┤',
joinJoin: '┼',
};
}
if (name === 'ramac') {
return {
topBody: '-',
topJoin: '+',
topLeft: '+',
topRight: '+',
bottomBody: '-',
bottomJoin: '+',
bottomLeft: '+',
bottomRight: '+',
bodyLeft: '|',
bodyRight: '|',
bodyJoin: '|',
headerJoin: '+',
joinBody: '-',
joinLeft: '|',
joinRight: '|',
joinJoin: '|',
};
}
if (name === 'void') {
return {
topBody: '',
topJoin: '',
topLeft: '',
topRight: '',
bottomBody: '',
bottomJoin: '',
bottomLeft: '',
bottomRight: '',
bodyLeft: '',
bodyRight: '',
bodyJoin: '',
headerJoin: '',
joinBody: '',
joinLeft: '',
joinRight: '',
joinJoin: '',
};
}
throw new Error('Unknown border template "' + name + '".');
};
var _default = getBorderCharacters;
exports.default = _default;
//# sourceMappingURL=getBorderCharacters.js.map
exports.getBorderCharacters = getBorderCharacters;

View file

@ -1,120 +0,0 @@
/* 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}
*/
export 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 + '".');
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/getBorderCharacters.js"],"names":["name","topBody","topJoin","topLeft","topRight","bottomBody","bottomJoin","bottomLeft","bottomRight","bodyLeft","bodyRight","bodyJoin","joinBody","joinLeft","joinRight","joinJoin","Error"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;;;;;;;;;AAmBA;;;;4BAIgBA,I,IAAS;AACvB,MAAIA,IAAI,KAAK,WAAb,EAA0B;AACxB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,MAAb,EAAqB;AACnB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,OAAb,EAAsB;AACpB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,MAAb,EAAqB;AACnB,WAAO;AACLC,MAAAA,OAAO,EAAE,EADJ;AAELC,MAAAA,OAAO,EAAE,EAFJ;AAGLC,MAAAA,OAAO,EAAE,EAHJ;AAILC,MAAAA,QAAQ,EAAE,EAJL;AAMLC,MAAAA,UAAU,EAAE,EANP;AAOLC,MAAAA,UAAU,EAAE,EAPP;AAQLC,MAAAA,UAAU,EAAE,EARP;AASLC,MAAAA,WAAW,EAAE,EATR;AAWLC,MAAAA,QAAQ,EAAE,EAXL;AAYLC,MAAAA,SAAS,EAAE,EAZN;AAaLC,MAAAA,QAAQ,EAAE,EAbL;AAeLC,MAAAA,QAAQ,EAAE,EAfL;AAgBLC,MAAAA,QAAQ,EAAE,EAhBL;AAiBLC,MAAAA,SAAS,EAAE,EAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,QAAM,IAAIC,KAAJ,CAAU,8BAA8BhB,IAA9B,GAAqC,IAA/C,CAAN;AACD,C","sourcesContent":["/* eslint-disable sort-keys */\n\n/**\n * @typedef border\n * @property {string} topBody\n * @property {string} topJoin\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} bottomBody\n * @property {string} bottomJoin\n * @property {string} bottomLeft\n * @property {string} bottomRight\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n * @property {string} joinBody\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinJoin\n */\n\n/**\n * @param {string} name\n * @returns {border}\n */\nexport default (name) => {\n if (name === 'honeywell') {\n return {\n topBody: '═',\n topJoin: '╤',\n topLeft: '╔',\n topRight: '╗',\n\n bottomBody: '═',\n bottomJoin: '╧',\n bottomLeft: '╚',\n bottomRight: '╝',\n\n bodyLeft: '║',\n bodyRight: '║',\n bodyJoin: '│',\n\n joinBody: '─',\n joinLeft: '╟',\n joinRight: '╢',\n joinJoin: '┼'\n };\n }\n\n if (name === 'norc') {\n return {\n topBody: '─',\n topJoin: '┬',\n topLeft: '┌',\n topRight: '┐',\n\n bottomBody: '─',\n bottomJoin: '┴',\n bottomLeft: '└',\n bottomRight: '┘',\n\n bodyLeft: '│',\n bodyRight: '│',\n bodyJoin: '│',\n\n joinBody: '─',\n joinLeft: '├',\n joinRight: '┤',\n joinJoin: '┼'\n };\n }\n\n if (name === 'ramac') {\n return {\n topBody: '-',\n topJoin: '+',\n topLeft: '+',\n topRight: '+',\n\n bottomBody: '-',\n bottomJoin: '+',\n bottomLeft: '+',\n bottomRight: '+',\n\n bodyLeft: '|',\n bodyRight: '|',\n bodyJoin: '|',\n\n joinBody: '-',\n joinLeft: '|',\n joinRight: '|',\n joinJoin: '|'\n };\n }\n\n if (name === 'void') {\n return {\n topBody: '',\n topJoin: '',\n topLeft: '',\n topRight: '',\n\n bottomBody: '',\n bottomJoin: '',\n bottomLeft: '',\n bottomRight: '',\n\n bodyLeft: '',\n bodyRight: '',\n bodyJoin: '',\n\n joinBody: '',\n joinLeft: '',\n joinRight: '',\n joinJoin: ''\n };\n }\n\n throw new Error('Unknown border template \"' + name + '\".');\n};\n"],"file":"getBorderCharacters.js"}

5
node_modules/table/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,5 @@
import { createStream } from './createStream';
import { getBorderCharacters } from './getBorderCharacters';
import { table } from './table';
export { table, createStream, getBorderCharacters, };
export * from './types/api';

50
node_modules/table/dist/index.js generated vendored
View file

@ -1,32 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "table", {
enumerable: true,
get: function get() {
return _table.default;
}
});
Object.defineProperty(exports, "createStream", {
enumerable: true,
get: function get() {
return _createStream.default;
}
});
Object.defineProperty(exports, "getBorderCharacters", {
enumerable: true,
get: function get() {
return _getBorderCharacters.default;
}
});
var _table = _interopRequireDefault(require("./table"));
var _createStream = _interopRequireDefault(require("./createStream"));
var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//# sourceMappingURL=index.js.map
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBorderCharacters = exports.createStream = exports.table = void 0;
const createStream_1 = require("./createStream");
Object.defineProperty(exports, "createStream", { enumerable: true, get: function () { return createStream_1.createStream; } });
const getBorderCharacters_1 = require("./getBorderCharacters");
Object.defineProperty(exports, "getBorderCharacters", { enumerable: true, get: function () { return getBorderCharacters_1.getBorderCharacters; } });
const table_1 = require("./table");
Object.defineProperty(exports, "table", { enumerable: true, get: function () { return table_1.table; } });
__exportStar(require("./types/api"), exports);

View file

@ -1,9 +0,0 @@
import table from './table';
import createStream from './createStream';
import getBorderCharacters from './getBorderCharacters';
export {
table,
createStream,
getBorderCharacters
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA","sourcesContent":["import table from './table';\nimport createStream from './createStream';\nimport getBorderCharacters from './getBorderCharacters';\n\nexport {\n table,\n createStream,\n getBorderCharacters\n};\n"],"file":"index.js"}

View file

@ -1,94 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
var _times2 = _interopRequireDefault(require("lodash/times"));
var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters"));
var _validateConfig = _interopRequireDefault(require("./validateConfig"));
var _calculateMaximumColumnWidthIndex = _interopRequireDefault(require("./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 = (border = {}) => {
return Object.assign({}, (0, _getBorderCharacters.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 = (rows, columns = {}, columnDefault = {}) => {
const maximumColumnWidthIndex = (0, _calculateMaximumColumnWidthIndex.default)(rows);
(0, _times2.default)(rows[0].length, index => {
if ((0, _isUndefined2.default)(columns[index])) {
columns[index] = {};
}
columns[index] = Object.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}
*/
const makeConfig = (rows, userConfig = {}) => {
(0, _validateConfig.default)('config.json', userConfig);
const config = (0, _cloneDeep2.default)(userConfig);
config.border = makeBorder(config.border);
config.columns = makeColumns(rows, config.columns, config.columnDefault);
if (!config.drawHorizontalLine) {
/**
* @returns {boolean}
*/
config.drawHorizontalLine = () => {
return true;
};
}
if (config.singleLine === undefined) {
config.singleLine = false;
}
return config;
};
var _default = makeConfig;
exports.default = _default;
//# sourceMappingURL=makeConfig.js.map

View file

@ -1,76 +0,0 @@
import _ from 'lodash';
import getBorderCharacters from './getBorderCharacters';
import validateConfig from './validateConfig';
import calculateMaximumColumnWidthIndex from './calculateMaximumColumnWidthIndex';
/**
* Merges user provided border characters with the default border ("honeywell") characters.
*
* @param {Object} border
* @returns {Object}
*/
const makeBorder = (border = {}) => {
return Object.assign({}, getBorderCharacters('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 = (rows, columns = {}, columnDefault = {}) => {
const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex(rows);
_.times(rows[0].length, (index) => {
if (_.isUndefined(columns[index])) {
columns[index] = {};
}
columns[index] = Object.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}
*/
export default (rows, userConfig = {}) => {
validateConfig('config.json', userConfig);
const config = _.cloneDeep(userConfig);
config.border = makeBorder(config.border);
config.columns = makeColumns(rows, config.columns, config.columnDefault);
if (!config.drawHorizontalLine) {
/**
* @returns {boolean}
*/
config.drawHorizontalLine = () => {
return true;
};
}
if (config.singleLine === undefined) {
config.singleLine = false;
}
return config;
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/makeConfig.js"],"names":["makeBorder","border","Object","assign","makeColumns","rows","columns","columnDefault","maximumColumnWidthIndex","length","index","alignment","paddingLeft","paddingRight","truncate","Infinity","width","wrapWord","userConfig","config","drawHorizontalLine","singleLine","undefined"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AACA;;;;AAEA;;;;;;AAMA,MAAMA,UAAU,GAAG,CAACC,MAAM,GAAG,EAAV,KAAiB;AAClC,SAAOC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,kCAAoB,WAApB,CAAlB,EAAoDF,MAApD,CAAP;AACD,CAFD;AAIA;;;;;;;;;;;AASA,MAAMG,WAAW,GAAG,CAACC,IAAD,EAAOC,OAAO,GAAG,EAAjB,EAAqBC,aAAa,GAAG,EAArC,KAA4C;AAC9D,QAAMC,uBAAuB,GAAG,+CAAiCH,IAAjC,CAAhC;AAEA,uBAAQA,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAAhB,EAAyBC,KAAD,IAAW;AACjC,QAAI,2BAAcJ,OAAO,CAACI,KAAD,CAArB,CAAJ,EAAmC;AACjCJ,MAAAA,OAAO,CAACI,KAAD,CAAP,GAAiB,EAAjB;AACD;;AAEDJ,IAAAA,OAAO,CAACI,KAAD,CAAP,GAAiBR,MAAM,CAACC,MAAP,CAAc;AAC7BQ,MAAAA,SAAS,EAAE,MADkB;AAE7BC,MAAAA,WAAW,EAAE,CAFgB;AAG7BC,MAAAA,YAAY,EAAE,CAHe;AAI7BC,MAAAA,QAAQ,EAAEC,QAJmB;AAK7BC,MAAAA,KAAK,EAAER,uBAAuB,CAACE,KAAD,CALD;AAM7BO,MAAAA,QAAQ,EAAE;AANmB,KAAd,EAOdV,aAPc,EAOCD,OAAO,CAACI,KAAD,CAPR,CAAjB;AAQD,GAbD;AAeA,SAAOJ,OAAP;AACD,CAnBD;AAqBA;;;;;;;;;;oBAQgBD,I,EAAMa,UAAU,GAAG,E,KAAO;AACxC,+BAAe,aAAf,EAA8BA,UAA9B;AAEA,QAAMC,MAAM,GAAG,yBAAYD,UAAZ,CAAf;AAEAC,EAAAA,MAAM,CAAClB,MAAP,GAAgBD,UAAU,CAACmB,MAAM,CAAClB,MAAR,CAA1B;AACAkB,EAAAA,MAAM,CAACb,OAAP,GAAiBF,WAAW,CAACC,IAAD,EAAOc,MAAM,CAACb,OAAd,EAAuBa,MAAM,CAACZ,aAA9B,CAA5B;;AAEA,MAAI,CAACY,MAAM,CAACC,kBAAZ,EAAgC;AAC9B;;;AAGAD,IAAAA,MAAM,CAACC,kBAAP,GAA4B,MAAM;AAChC,aAAO,IAAP;AACD,KAFD;AAGD;;AAED,MAAID,MAAM,CAACE,UAAP,KAAsBC,SAA1B,EAAqC;AACnCH,IAAAA,MAAM,CAACE,UAAP,GAAoB,KAApB;AACD;;AAED,SAAOF,MAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport getBorderCharacters from './getBorderCharacters';\nimport validateConfig from './validateConfig';\nimport calculateMaximumColumnWidthIndex from './calculateMaximumColumnWidthIndex';\n\n/**\n * Merges user provided border characters with the default border (\"honeywell\") characters.\n *\n * @param {Object} border\n * @returns {Object}\n */\nconst makeBorder = (border = {}) => {\n return Object.assign({}, getBorderCharacters('honeywell'), border);\n};\n\n/**\n * Creates a configuration for every column using default\n * values for the missing configuration properties.\n *\n * @param {Array[]} rows\n * @param {Object} columns\n * @param {Object} columnDefault\n * @returns {Object}\n */\nconst makeColumns = (rows, columns = {}, columnDefault = {}) => {\n const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex(rows);\n\n _.times(rows[0].length, (index) => {\n if (_.isUndefined(columns[index])) {\n columns[index] = {};\n }\n\n columns[index] = Object.assign({\n alignment: 'left',\n paddingLeft: 1,\n paddingRight: 1,\n truncate: Infinity,\n width: maximumColumnWidthIndex[index],\n wrapWord: false\n }, columnDefault, columns[index]);\n });\n\n return columns;\n};\n\n/**\n * Makes a new configuration object out of the userConfig object\n * using default values for the missing configuration properties.\n *\n * @param {Array[]} rows\n * @param {Object} userConfig\n * @returns {Object}\n */\nexport default (rows, userConfig = {}) => {\n validateConfig('config.json', userConfig);\n\n const config = _.cloneDeep(userConfig);\n\n config.border = makeBorder(config.border);\n config.columns = makeColumns(rows, config.columns, config.columnDefault);\n\n if (!config.drawHorizontalLine) {\n /**\n * @returns {boolean}\n */\n config.drawHorizontalLine = () => {\n return true;\n };\n }\n\n if (config.singleLine === undefined) {\n config.singleLine = false;\n }\n\n return config;\n};\n"],"file":"makeConfig.js"}

7
node_modules/table/dist/makeStreamConfig.d.ts generated vendored Normal file
View file

@ -0,0 +1,7 @@
import type { StreamUserConfig } from './types/api';
import type { StreamConfig } from './types/internal';
/**
* Makes a new configuration object out of the userConfig object
* using default values for the missing configuration properties.
*/
export declare const makeStreamConfig: (userConfig: StreamUserConfig) => StreamConfig;

View file

@ -1,101 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
var _times2 = _interopRequireDefault(require("lodash/times"));
var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters"));
var _validateConfig = _interopRequireDefault(require("./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 = (border = {}) => {
return Object.assign({}, (0, _getBorderCharacters.default)('honeywell'), border);
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeStreamConfig = void 0;
const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
const utils_1 = require("./utils");
const validateConfig_1 = require("./validateConfig");
/**
* 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 = (columnCount, columns = {}, columnDefault = {}) => {
(0, _times2.default)(columnCount, index => {
if ((0, _isUndefined2.default)(columns[index])) {
columns[index] = {};
}
columns[index] = Object.assign({
alignment: 'left',
paddingLeft: 1,
paddingRight: 1,
truncate: Infinity,
wrapWord: false
}, columnDefault, columns[index]);
});
return columns;
const makeColumnsConfig = (columnCount, columns = {}, columnDefault) => {
return Array.from({ length: columnCount }).map((_, index) => {
return {
alignment: 'left',
paddingLeft: 1,
paddingRight: 1,
truncate: Number.POSITIVE_INFINITY,
verticalAlignment: 'top',
wrapWord: false,
...columnDefault,
...columns[index],
};
});
};
/**
* @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}
*/
const makeStreamConfig = (userConfig = {}) => {
(0, _validateConfig.default)('streamConfig.json', userConfig);
const config = (0, _cloneDeep2.default)(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;
const makeStreamConfig = (userConfig) => {
validateConfig_1.validateConfig('streamConfig.json', userConfig);
const config = lodash_clonedeep_1.default(userConfig);
if (config.columnDefault.width === undefined) {
throw new Error('Must provide config.columnDefault.width when creating a stream.');
}
return {
drawVerticalLine: () => {
return true;
},
...config,
border: utils_1.makeBorderConfig(config.border),
columns: makeColumnsConfig(config.columnCount, config.columns, config.columnDefault),
};
};
var _default = makeStreamConfig;
exports.default = _default;
//# sourceMappingURL=makeStreamConfig.js.map
exports.makeStreamConfig = makeStreamConfig;

View file

@ -1,83 +0,0 @@
import _ from 'lodash';
import getBorderCharacters from './getBorderCharacters';
import validateConfig from './validateConfig';
/**
* Merges user provided border characters with the default border ("honeywell") characters.
*
* @param {Object} border
* @returns {Object}
*/
const makeBorder = (border = {}) => {
return Object.assign({}, getBorderCharacters('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 = (columnCount, columns = {}, columnDefault = {}) => {
_.times(columnCount, (index) => {
if (_.isUndefined(columns[index])) {
columns[index] = {};
}
columns[index] = Object.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}
*/
export default (userConfig = {}) => {
validateConfig('streamConfig.json', userConfig);
const config = _.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;
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/makeStreamConfig.js"],"names":["makeBorder","border","Object","assign","makeColumns","columnCount","columns","columnDefault","index","alignment","paddingLeft","paddingRight","truncate","Infinity","wrapWord","userConfig","config","width","Error"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;;;AAEA;;;;;;AAMA,MAAMA,UAAU,GAAG,CAACC,MAAM,GAAG,EAAV,KAAiB;AAClC,SAAOC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,kCAAoB,WAApB,CAAlB,EAAoDF,MAApD,CAAP;AACD,CAFD;AAIA;;;;;;;;;;;AASA,MAAMG,WAAW,GAAG,CAACC,WAAD,EAAcC,OAAO,GAAG,EAAxB,EAA4BC,aAAa,GAAG,EAA5C,KAAmD;AACrE,uBAAQF,WAAR,EAAsBG,KAAD,IAAW;AAC9B,QAAI,2BAAcF,OAAO,CAACE,KAAD,CAArB,CAAJ,EAAmC;AACjCF,MAAAA,OAAO,CAACE,KAAD,CAAP,GAAiB,EAAjB;AACD;;AAEDF,IAAAA,OAAO,CAACE,KAAD,CAAP,GAAiBN,MAAM,CAACC,MAAP,CAAc;AAC7BM,MAAAA,SAAS,EAAE,MADkB;AAE7BC,MAAAA,WAAW,EAAE,CAFgB;AAG7BC,MAAAA,YAAY,EAAE,CAHe;AAI7BC,MAAAA,QAAQ,EAAEC,QAJmB;AAK7BC,MAAAA,QAAQ,EAAE;AALmB,KAAd,EAMdP,aANc,EAMCD,OAAO,CAACE,KAAD,CANR,CAAjB;AAOD,GAZD;AAcA,SAAOF,OAAP;AACD,CAhBD;AAkBA;;;;;;;;;AASA;;;;;;;;AAQA;;;;;;;;;0BAOgBS,UAAU,GAAG,E,KAAO;AAClC,+BAAe,mBAAf,EAAoCA,UAApC;AAEA,QAAMC,MAAM,GAAG,yBAAYD,UAAZ,CAAf;;AAEA,MAAI,CAACC,MAAM,CAACT,aAAR,IAAyB,CAACS,MAAM,CAACT,aAAP,CAAqBU,KAAnD,EAA0D;AACxD,UAAM,IAAIC,KAAJ,CAAU,iEAAV,CAAN;AACD;;AAED,MAAI,CAACF,MAAM,CAACX,WAAZ,EAAyB;AACvB,UAAM,IAAIa,KAAJ,CAAU,kCAAV,CAAN;AACD;;AAEDF,EAAAA,MAAM,CAACf,MAAP,GAAgBD,UAAU,CAACgB,MAAM,CAACf,MAAR,CAA1B;AACAe,EAAAA,MAAM,CAACV,OAAP,GAAiBF,WAAW,CAACY,MAAM,CAACX,WAAR,EAAqBW,MAAM,CAACV,OAA5B,EAAqCU,MAAM,CAACT,aAA5C,CAA5B;AAEA,SAAOS,MAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport getBorderCharacters from './getBorderCharacters';\nimport validateConfig from './validateConfig';\n\n/**\n * Merges user provided border characters with the default border (\"honeywell\") characters.\n *\n * @param {Object} border\n * @returns {Object}\n */\nconst makeBorder = (border = {}) => {\n return Object.assign({}, getBorderCharacters('honeywell'), border);\n};\n\n/**\n * Creates a configuration for every column using default\n * values for the missing configuration properties.\n *\n * @param {number} columnCount\n * @param {Object} columns\n * @param {Object} columnDefault\n * @returns {Object}\n */\nconst makeColumns = (columnCount, columns = {}, columnDefault = {}) => {\n _.times(columnCount, (index) => {\n if (_.isUndefined(columns[index])) {\n columns[index] = {};\n }\n\n columns[index] = Object.assign({\n alignment: 'left',\n paddingLeft: 1,\n paddingRight: 1,\n truncate: Infinity,\n wrapWord: false\n }, columnDefault, columns[index]);\n });\n\n return columns;\n};\n\n/**\n * @typedef {Object} columnConfig\n * @property {string} alignment\n * @property {number} width\n * @property {number} truncate\n * @property {number} paddingLeft\n * @property {number} paddingRight\n */\n\n/**\n * @typedef {Object} streamConfig\n * @property {columnConfig} columnDefault\n * @property {Object} border\n * @property {columnConfig[]}\n * @property {number} columnCount Number of columns in the table (required).\n */\n\n/**\n * Makes a new configuration object out of the userConfig object\n * using default values for the missing configuration properties.\n *\n * @param {streamConfig} userConfig\n * @returns {Object}\n */\nexport default (userConfig = {}) => {\n validateConfig('streamConfig.json', userConfig);\n\n const config = _.cloneDeep(userConfig);\n\n if (!config.columnDefault || !config.columnDefault.width) {\n throw new Error('Must provide config.columnDefault.width when creating a stream.');\n }\n\n if (!config.columnCount) {\n throw new Error('Must provide config.columnCount.');\n }\n\n config.border = makeBorder(config.border);\n config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);\n\n return config;\n};\n"],"file":"makeStreamConfig.js"}

7
node_modules/table/dist/makeTableConfig.d.ts generated vendored Normal file
View file

@ -0,0 +1,7 @@
import type { TableUserConfig } from './types/api';
import type { Row, TableConfig } from './types/internal';
/**
* Makes a new configuration object out of the userConfig object
* using default values for the missing configuration properties.
*/
export declare const makeTableConfig: (rows: Row[], userConfig?: TableUserConfig) => TableConfig;

66
node_modules/table/dist/makeTableConfig.js generated vendored Normal file
View file

@ -0,0 +1,66 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeTableConfig = void 0;
const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
const calculateColumnWidths_1 = __importDefault(require("./calculateColumnWidths"));
const utils_1 = require("./utils");
const validateConfig_1 = require("./validateConfig");
/**
* Creates a configuration for every column using default
* values for the missing configuration properties.
*/
const makeColumnsConfig = (rows, columns, columnDefault) => {
const columnWidths = calculateColumnWidths_1.default(rows);
return rows[0].map((_, columnIndex) => {
return {
alignment: 'left',
paddingLeft: 1,
paddingRight: 1,
truncate: Number.POSITIVE_INFINITY,
verticalAlignment: 'top',
width: columnWidths[columnIndex],
wrapWord: false,
...columnDefault,
...columns === null || columns === void 0 ? void 0 : columns[columnIndex],
};
});
};
const makeHeaderConfig = (config) => {
if (!config.header) {
return undefined;
}
return {
alignment: 'center',
paddingLeft: 1,
paddingRight: 1,
truncate: Number.POSITIVE_INFINITY,
wrapWord: false,
...config.header,
};
};
/**
* Makes a new configuration object out of the userConfig object
* using default values for the missing configuration properties.
*/
const makeTableConfig = (rows, userConfig = {}) => {
var _a, _b, _c;
validateConfig_1.validateConfig('config.json', userConfig);
const config = lodash_clonedeep_1.default(userConfig);
return {
...config,
border: utils_1.makeBorderConfig(config.border),
columns: makeColumnsConfig(rows, config.columns, config.columnDefault),
drawHorizontalLine: (_a = config.drawHorizontalLine) !== null && _a !== void 0 ? _a : (() => {
return true;
}),
drawVerticalLine: (_b = config.drawVerticalLine) !== null && _b !== void 0 ? _b : (() => {
return true;
}),
header: makeHeaderConfig(config),
singleLine: (_c = config.singleLine) !== null && _c !== void 0 ? _c : false,
};
};
exports.makeTableConfig = makeTableConfig;

View file

@ -1,44 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _flatten2 = _interopRequireDefault(require("lodash/flatten"));
var _times2 = _interopRequireDefault(require("lodash/times"));
var _wrapCell = _interopRequireDefault(require("./wrapCell"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @param {Array} unmappedRows
* @param {number[]} rowHeightIndex
* @param {Object} config
* @returns {Array}
*/
const mapDataUsingRowHeightIndex = (unmappedRows, rowHeightIndex, config) => {
const tableWidth = unmappedRows[0].length;
const mappedRows = unmappedRows.map((cells, index0) => {
const rowHeight = (0, _times2.default)(rowHeightIndex[index0], () => {
return new Array(tableWidth).fill('');
}); // rowHeight
// [{row index within rowSaw; index2}]
// [{cell index within a virtual row; index1}]
cells.forEach((value, index1) => {
const cellLines = (0, _wrapCell.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
cellLines.forEach((cellLine, index2) => {
rowHeight[index2][index1] = cellLine;
});
});
return rowHeight;
});
return (0, _flatten2.default)(mappedRows);
};
var _default = mapDataUsingRowHeightIndex;
exports.default = _default;
//# sourceMappingURL=mapDataUsingRowHeightIndex.js.map

View file

@ -1,34 +0,0 @@
import _ from 'lodash';
import wrapCell from './wrapCell';
/**
* @param {Array} unmappedRows
* @param {number[]} rowHeightIndex
* @param {Object} config
* @returns {Array}
*/
export default (unmappedRows, rowHeightIndex, config) => {
const tableWidth = unmappedRows[0].length;
const mappedRows = unmappedRows.map((cells, index0) => {
const rowHeight = _.times(rowHeightIndex[index0], () => {
return new Array(tableWidth).fill('');
});
// rowHeight
// [{row index within rowSaw; index2}]
// [{cell index within a virtual row; index1}]
cells.forEach((value, index1) => {
const cellLines = wrapCell(value, config.columns[index1].width, config.columns[index1].wrapWord);
cellLines.forEach((cellLine, index2) => {
rowHeight[index2][index1] = cellLine;
});
});
return rowHeight;
});
return _.flatten(mappedRows);
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/mapDataUsingRowHeightIndex.js"],"names":["unmappedRows","rowHeightIndex","config","tableWidth","length","mappedRows","map","cells","index0","rowHeight","Array","fill","forEach","value","index1","cellLines","columns","width","wrapWord","cellLine","index2"],"mappings":";;;;;;;;;;;AACA;;;;AAEA;;;;;;oCAMgBA,Y,EAAcC,c,EAAgBC,M,KAAW;AACvD,QAAMC,UAAU,GAAGH,YAAY,CAAC,CAAD,CAAZ,CAAgBI,MAAnC;AAEA,QAAMC,UAAU,GAAGL,YAAY,CAACM,GAAb,CAAiB,CAACC,KAAD,EAAQC,MAAR,KAAmB;AACrD,UAAMC,SAAS,GAAG,qBAAQR,cAAc,CAACO,MAAD,CAAtB,EAAgC,MAAM;AACtD,aAAO,IAAIE,KAAJ,CAAUP,UAAV,EAAsBQ,IAAtB,CAA2B,EAA3B,CAAP;AACD,KAFiB,CAAlB,CADqD,CAKrD;AACA;AACA;;AAEAJ,IAAAA,KAAK,CAACK,OAAN,CAAc,CAACC,KAAD,EAAQC,MAAR,KAAmB;AAC/B,YAAMC,SAAS,GAAG,uBAASF,KAAT,EAAgBX,MAAM,CAACc,OAAP,CAAeF,MAAf,EAAuBG,KAAvC,EAA8Cf,MAAM,CAACc,OAAP,CAAeF,MAAf,EAAuBI,QAArE,CAAlB;AAEAH,MAAAA,SAAS,CAACH,OAAV,CAAkB,CAACO,QAAD,EAAWC,MAAX,KAAsB;AACtCX,QAAAA,SAAS,CAACW,MAAD,CAAT,CAAkBN,MAAlB,IAA4BK,QAA5B;AACD,OAFD;AAGD,KAND;AAQA,WAAOV,SAAP;AACD,GAlBkB,CAAnB;AAoBA,SAAO,uBAAUJ,UAAV,CAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport wrapCell from './wrapCell';\n\n/**\n * @param {Array} unmappedRows\n * @param {number[]} rowHeightIndex\n * @param {Object} config\n * @returns {Array}\n */\nexport default (unmappedRows, rowHeightIndex, config) => {\n const tableWidth = unmappedRows[0].length;\n\n const mappedRows = unmappedRows.map((cells, index0) => {\n const rowHeight = _.times(rowHeightIndex[index0], () => {\n return new Array(tableWidth).fill('');\n });\n\n // rowHeight\n // [{row index within rowSaw; index2}]\n // [{cell index within a virtual row; index1}]\n\n cells.forEach((value, index1) => {\n const cellLines = wrapCell(value, config.columns[index1].width, config.columns[index1].wrapWord);\n\n cellLines.forEach((cellLine, index2) => {\n rowHeight[index2][index1] = cellLine;\n });\n });\n\n return rowHeight;\n });\n\n return _.flatten(mappedRows);\n};\n"],"file":"mapDataUsingRowHeightIndex.js"}

2
node_modules/table/dist/mapDataUsingRowHeights.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
import type { BaseConfig, Row } from './types/internal';
export declare const mapDataUsingRowHeights: (unmappedRows: Row[], rowHeights: number[], config: BaseConfig) => Row[];

44
node_modules/table/dist/mapDataUsingRowHeights.js generated vendored Normal file
View file

@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapDataUsingRowHeights = void 0;
const wrapCell_1 = require("./wrapCell");
const createEmptyStrings = (length) => {
return new Array(length).fill('');
};
const padCellVertically = (lines, rowHeight, columnConfig) => {
const { verticalAlignment } = columnConfig;
const availableLines = rowHeight - lines.length;
if (verticalAlignment === 'top') {
return [...lines, ...createEmptyStrings(availableLines)];
}
if (verticalAlignment === 'bottom') {
return [...createEmptyStrings(availableLines), ...lines];
}
return [
...createEmptyStrings(Math.floor(availableLines / 2)),
...lines,
...createEmptyStrings(Math.ceil(availableLines / 2)),
];
};
const flatten = (array) => {
return [].concat(...array);
};
const mapDataUsingRowHeights = (unmappedRows, rowHeights, config) => {
const tableWidth = unmappedRows[0].length;
const mappedRows = unmappedRows.map((unmappedRow, unmappedRowIndex) => {
const outputRowHeight = rowHeights[unmappedRowIndex];
const outputRow = Array.from({ length: outputRowHeight }, () => {
return new Array(tableWidth).fill('');
});
unmappedRow.forEach((cell, cellIndex) => {
const cellLines = wrapCell_1.wrapCell(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord);
const paddedCellLines = padCellVertically(cellLines, outputRowHeight, config.columns[cellIndex]);
paddedCellLines.forEach((cellLine, cellLineIndex) => {
outputRow[cellLineIndex][cellIndex] = cellLine;
});
});
return outputRow;
});
return flatten(mappedRows);
};
exports.mapDataUsingRowHeights = mapDataUsingRowHeights;

3
node_modules/table/dist/padTableData.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
import type { BaseConfig, Row } from './types/internal';
export declare const padString: (input: string, paddingLeft: number, paddingRight: number) => string;
export declare const padTableData: (rows: Row[], config: BaseConfig) => Row[];

View file

@ -1,24 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* @param {table~row[]} rows
* @param {Object} config
* @returns {table~row[]}
*/
const padTableData = (rows, config) => {
return rows.map(cells => {
return cells.map((value, index1) => {
const column = config.columns[index1];
return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight);
});
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.padTableData = exports.padString = void 0;
const padString = (input, paddingLeft, paddingRight) => {
return ' '.repeat(paddingLeft) + input + ' '.repeat(paddingRight);
};
var _default = padTableData;
exports.default = _default;
//# sourceMappingURL=padTableData.js.map
exports.padString = padString;
const padTableData = (rows, config) => {
return rows.map((cells) => {
return cells.map((cell, cellIndex) => {
const { paddingLeft, paddingRight } = config.columns[cellIndex];
return exports.padString(cell, paddingLeft, paddingRight);
});
});
};
exports.padTableData = padTableData;

View file

@ -1,14 +0,0 @@
/**
* @param {table~row[]} rows
* @param {Object} config
* @returns {table~row[]}
*/
export default (rows, config) => {
return rows.map((cells) => {
return cells.map((value, index1) => {
const column = config.columns[index1];
return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight);
});
});
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/padTableData.js"],"names":["rows","config","map","cells","value","index1","column","columns","repeat","paddingLeft","paddingRight"],"mappings":";;;;;;;AAAA;;;;;sBAKgBA,I,EAAMC,M,KAAW;AAC/B,SAAOD,IAAI,CAACE,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAU,CAACE,KAAD,EAAQC,MAAR,KAAmB;AAClC,YAAMC,MAAM,GAAGL,MAAM,CAACM,OAAP,CAAeF,MAAf,CAAf;AAEA,aAAO,IAAIG,MAAJ,CAAWF,MAAM,CAACG,WAAlB,IAAiCL,KAAjC,GAAyC,IAAII,MAAJ,CAAWF,MAAM,CAACI,YAAlB,CAAhD;AACD,KAJM,CAAP;AAKD,GANM,CAAP;AAOD,C","sourcesContent":["/**\n * @param {table~row[]} rows\n * @param {Object} config\n * @returns {table~row[]}\n */\nexport default (rows, config) => {\n return rows.map((cells) => {\n return cells.map((value, index1) => {\n const column = config.columns[index1];\n\n return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight);\n });\n });\n};\n"],"file":"padTableData.js"}

View file

@ -1,114 +0,0 @@
{
"$id": "config.json",
"$schema": "http://json-schema.org/draft-07/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"
}
}
}

View file

@ -1,114 +0,0 @@
{
"$id": "streamConfig.json",
"$schema": "http://json-schema.org/draft-07/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"
}
}
}

2
node_modules/table/dist/stringifyTableData.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
import type { Row } from './types/internal';
export declare const stringifyTableData: (rows: unknown[][]) => Row[];

View file

@ -1,22 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* Casts all cell values to a string.
*
* @param {table~row[]} rows
* @returns {table~row[]}
*/
const stringifyTableData = rows => {
return rows.map(cells => {
return cells.map(String);
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringifyTableData = void 0;
const utils_1 = require("./utils");
const stringifyTableData = (rows) => {
return rows.map((cells) => {
return cells.map((cell) => {
return utils_1.normalizeString(String(cell));
});
});
};
var _default = stringifyTableData;
exports.default = _default;
//# sourceMappingURL=stringifyTableData.js.map
exports.stringifyTableData = stringifyTableData;

View file

@ -1,11 +0,0 @@
/**
* Casts all cell values to a string.
*
* @param {table~row[]} rows
* @returns {table~row[]}
*/
export default (rows) => {
return rows.map((cells) => {
return cells.map(String);
});
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/stringifyTableData.js"],"names":["rows","map","cells","String"],"mappings":";;;;;;;AAAA;;;;;;2BAMgBA,I,IAAS;AACvB,SAAOA,IAAI,CAACC,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAUE,MAAV,CAAP;AACD,GAFM,CAAP;AAGD,C","sourcesContent":["/**\n * Casts all cell values to a string.\n *\n * @param {table~row[]} rows\n * @returns {table~row[]}\n */\nexport default (rows) => {\n return rows.map((cells) => {\n return cells.map(String);\n });\n};\n"],"file":"stringifyTableData.js"}

2
node_modules/table/dist/table.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
import type { TableUserConfig } from './types/api';
export declare const table: (data: unknown[][], userConfig?: TableUserConfig) => string;

130
node_modules/table/dist/table.js generated vendored
View file

@ -1,110 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _drawTable = _interopRequireDefault(require("./drawTable"));
var _calculateCellWidthIndex = _interopRequireDefault(require("./calculateCellWidthIndex"));
var _makeConfig = _interopRequireDefault(require("./makeConfig"));
var _calculateRowHeightIndex = _interopRequireDefault(require("./calculateRowHeightIndex"));
var _mapDataUsingRowHeightIndex = _interopRequireDefault(require("./mapDataUsingRowHeightIndex"));
var _alignTableData = _interopRequireDefault(require("./alignTableData"));
var _padTableData = _interopRequireDefault(require("./padTableData"));
var _validateTableData = _interopRequireDefault(require("./validateTableData"));
var _stringifyTableData = _interopRequireDefault(require("./stringifyTableData"));
var _truncateTableData = _interopRequireDefault(require("./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 {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters
* @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
* @property {table~singleLine} singleLine Horizontal lines inside the table are not drawn.
*/
/**
* Generates a text table.
*
* @param {table~row[]} data
* @param {table~config} userConfig
* @returns {string}
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.table = void 0;
const alignTableData_1 = require("./alignTableData");
const calculateCellWidths_1 = require("./calculateCellWidths");
const calculateRowHeights_1 = require("./calculateRowHeights");
const drawTable_1 = require("./drawTable");
const makeTableConfig_1 = require("./makeTableConfig");
const mapDataUsingRowHeights_1 = require("./mapDataUsingRowHeights");
const padTableData_1 = require("./padTableData");
const stringifyTableData_1 = require("./stringifyTableData");
const truncateTableData_1 = require("./truncateTableData");
const validateTableData_1 = require("./validateTableData");
const table = (data, userConfig = {}) => {
let rows;
(0, _validateTableData.default)(data);
rows = (0, _stringifyTableData.default)(data);
const config = (0, _makeConfig.default)(rows, userConfig);
rows = (0, _truncateTableData.default)(data, config);
const rowHeightIndex = (0, _calculateRowHeightIndex.default)(rows, config);
rows = (0, _mapDataUsingRowHeightIndex.default)(rows, rowHeightIndex, config);
rows = (0, _alignTableData.default)(rows, config);
rows = (0, _padTableData.default)(rows, config);
const cellWidthIndex = (0, _calculateCellWidthIndex.default)(rows[0]);
return (0, _drawTable.default)(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine, config.singleLine);
validateTableData_1.validateTableData(data);
let rows = stringifyTableData_1.stringifyTableData(data);
const config = makeTableConfig_1.makeTableConfig(rows, userConfig);
rows = truncateTableData_1.truncateTableData(rows, config);
const rowHeights = calculateRowHeights_1.calculateRowHeights(rows, config);
rows = mapDataUsingRowHeights_1.mapDataUsingRowHeights(rows, rowHeights, config);
rows = alignTableData_1.alignTableData(rows, config);
rows = padTableData_1.padTableData(rows, config);
const cellWidths = calculateCellWidths_1.calculateCellWidths(rows[0]);
return drawTable_1.drawTable(rows, cellWidths, rowHeights, config);
};
var _default = table;
exports.default = _default;
//# sourceMappingURL=table.js.map
exports.table = table;

View file

@ -1,96 +0,0 @@
import drawTable from './drawTable';
import calculateCellWidthIndex from './calculateCellWidthIndex';
import makeConfig from './makeConfig';
import calculateRowHeightIndex from './calculateRowHeightIndex';
import mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex';
import alignTableData from './alignTableData';
import padTableData from './padTableData';
import validateTableData from './validateTableData';
import stringifyTableData from './stringifyTableData';
import truncateTableData from './truncateTableData';
/**
* @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 {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters
* @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
* @property {table~singleLine} singleLine Horizontal lines inside the table are not drawn.
*/
/**
* Generates a text table.
*
* @param {table~row[]} data
* @param {table~config} userConfig
* @returns {string}
*/
export default (data, userConfig = {}) => {
let rows;
validateTableData(data);
rows = stringifyTableData(data);
const config = makeConfig(rows, userConfig);
rows = truncateTableData(data, config);
const rowHeightIndex = calculateRowHeightIndex(rows, config);
rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config);
rows = alignTableData(rows, config);
rows = padTableData(rows, config);
const cellWidthIndex = calculateCellWidthIndex(rows[0]);
return drawTable(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine, config.singleLine);
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/table.js"],"names":["data","userConfig","rows","config","rowHeightIndex","cellWidthIndex","border","drawHorizontalLine","singleLine"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA;;;;AAIA;;;;AAIA;;;;;;;;;;AAUA;;;;;;;;;;;;;;;;;;;AAmBA;;;;;;;;;;;AAWA;;;;;;;;;AASA;;;;;;;eAOgBA,I,EAAMC,UAAU,GAAG,E,KAAO;AACxC,MAAIC,IAAJ;AAEA,kCAAkBF,IAAlB;AAEAE,EAAAA,IAAI,GAAG,iCAAmBF,IAAnB,CAAP;AAEA,QAAMG,MAAM,GAAG,yBAAWD,IAAX,EAAiBD,UAAjB,CAAf;AAEAC,EAAAA,IAAI,GAAG,gCAAkBF,IAAlB,EAAwBG,MAAxB,CAAP;AAEA,QAAMC,cAAc,GAAG,sCAAwBF,IAAxB,EAA8BC,MAA9B,CAAvB;AAEAD,EAAAA,IAAI,GAAG,yCAA2BA,IAA3B,EAAiCE,cAAjC,EAAiDD,MAAjD,CAAP;AACAD,EAAAA,IAAI,GAAG,6BAAeA,IAAf,EAAqBC,MAArB,CAAP;AACAD,EAAAA,IAAI,GAAG,2BAAaA,IAAb,EAAmBC,MAAnB,CAAP;AAEA,QAAME,cAAc,GAAG,sCAAwBH,IAAI,CAAC,CAAD,CAA5B,CAAvB;AAEA,SAAO,wBAAUA,IAAV,EAAgBC,MAAM,CAACG,MAAvB,EAA+BD,cAA/B,EAA+CD,cAA/C,EAA+DD,MAAM,CAACI,kBAAtE,EAA0FJ,MAAM,CAACK,UAAjG,CAAP;AACD,C","sourcesContent":["import drawTable from './drawTable';\nimport calculateCellWidthIndex from './calculateCellWidthIndex';\nimport makeConfig from './makeConfig';\nimport calculateRowHeightIndex from './calculateRowHeightIndex';\nimport mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex';\nimport alignTableData from './alignTableData';\nimport padTableData from './padTableData';\nimport validateTableData from './validateTableData';\nimport stringifyTableData from './stringifyTableData';\nimport truncateTableData from './truncateTableData';\n\n/**\n * @typedef {string} table~cell\n */\n\n/**\n * @typedef {table~cell[]} table~row\n */\n\n/**\n * @typedef {Object} table~columns\n * @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).\n * @property {number} width Column width (default: auto).\n * @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).\n * @property {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters\n * @property {number} paddingLeft Cell content padding width left (default: 1).\n * @property {number} paddingRight Cell content padding width right (default: 1).\n */\n\n/**\n * @typedef {Object} table~border\n * @property {string} topBody\n * @property {string} topJoin\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} bottomBody\n * @property {string} bottomJoin\n * @property {string} bottomLeft\n * @property {string} bottomRight\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n * @property {string} joinBody\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinJoin\n */\n\n/**\n * Used to tell whether to draw a horizontal line.\n * This callback is called for each non-content line of the table.\n * The default behavior is to always return true.\n *\n * @typedef {Function} drawHorizontalLine\n * @param {number} index\n * @param {number} size\n * @returns {boolean}\n */\n\n/**\n * @typedef {Object} table~config\n * @property {table~border} border\n * @property {table~columns[]} columns Column specific configuration.\n * @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.\n * @property {table~drawHorizontalLine} drawHorizontalLine\n * @property {table~singleLine} singleLine Horizontal lines inside the table are not drawn.\n */\n\n/**\n * Generates a text table.\n *\n * @param {table~row[]} data\n * @param {table~config} userConfig\n * @returns {string}\n */\nexport default (data, userConfig = {}) => {\n let rows;\n\n validateTableData(data);\n\n rows = stringifyTableData(data);\n\n const config = makeConfig(rows, userConfig);\n\n rows = truncateTableData(data, config);\n\n const rowHeightIndex = calculateRowHeightIndex(rows, config);\n\n rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config);\n rows = alignTableData(rows, config);\n rows = padTableData(rows, config);\n\n const cellWidthIndex = calculateCellWidthIndex(rows[0]);\n\n return drawTable(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine, config.singleLine);\n};\n"],"file":"table.js"}

6
node_modules/table/dist/truncateTableData.d.ts generated vendored Normal file
View file

@ -0,0 +1,6 @@
import type { BaseConfig, Row } from './types/internal';
export declare const truncateString: (input: string, length: number) => string;
/**
* @todo Make it work with ASCII content.
*/
export declare const truncateTableData: (rows: Row[], config: BaseConfig) => Row[];

View file

@ -1,30 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _truncate2 = _interopRequireDefault(require("lodash/truncate"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.truncateTableData = exports.truncateString = void 0;
const lodash_truncate_1 = __importDefault(require("lodash.truncate"));
const truncateString = (input, length) => {
return lodash_truncate_1.default(input, { length,
omission: '…' });
};
exports.truncateString = truncateString;
/**
* @todo Make it work with ASCII content.
* @param {table~row[]} rows
* @param {Object} config
* @returns {table~row[]}
*/
const truncateTableData = (rows, config) => {
return rows.map(cells => {
return cells.map((content, index) => {
return (0, _truncate2.default)(content, {
length: config.columns[index].truncate
});
return rows.map((cells) => {
return cells.map((cell, cellIndex) => {
return exports.truncateString(cell, config.columns[cellIndex].truncate);
});
});
});
};
var _default = truncateTableData;
exports.default = _default;
//# sourceMappingURL=truncateTableData.js.map
exports.truncateTableData = truncateTableData;

View file

@ -1,17 +0,0 @@
import _ from 'lodash';
/**
* @todo Make it work with ASCII content.
* @param {table~row[]} rows
* @param {Object} config
* @returns {table~row[]}
*/
export default (rows, config) => {
return rows.map((cells) => {
return cells.map((content, index) => {
return _.truncate(content, {
length: config.columns[index].truncate
});
});
});
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/truncateTableData.js"],"names":["rows","config","map","cells","content","index","length","columns","truncate"],"mappings":";;;;;;;;;;;AAEA;;;;;;2BAMgBA,I,EAAMC,M,KAAW;AAC/B,SAAOD,IAAI,CAACE,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAU,CAACE,OAAD,EAAUC,KAAV,KAAoB;AACnC,aAAO,wBAAWD,OAAX,EAAoB;AACzBE,QAAAA,MAAM,EAAEL,MAAM,CAACM,OAAP,CAAeF,KAAf,EAAsBG;AADL,OAApB,CAAP;AAGD,KAJM,CAAP;AAKD,GANM,CAAP;AAOD,C","sourcesContent":["import _ from 'lodash';\n\n/**\n * @todo Make it work with ASCII content.\n * @param {table~row[]} rows\n * @param {Object} config\n * @returns {table~row[]}\n */\nexport default (rows, config) => {\n return rows.map((cells) => {\n return cells.map((content, index) => {\n return _.truncate(content, {\n length: config.columns[index].truncate\n });\n });\n });\n};\n"],"file":"truncateTableData.js"}

114
node_modules/table/dist/types/api.d.ts generated vendored Normal file
View file

@ -0,0 +1,114 @@
export declare type DrawLinePredicate = (index: number, size: number) => boolean;
export declare type DrawVerticalLine = DrawLinePredicate;
export declare type DrawHorizontalLine = DrawLinePredicate;
export declare type BorderUserConfig = {
readonly topLeft?: string;
readonly topRight?: string;
readonly topBody?: string;
readonly topJoin?: string;
readonly bottomLeft?: string;
readonly bottomRight?: string;
readonly bottomBody?: string;
readonly bottomJoin?: string;
readonly joinLeft?: string;
readonly joinRight?: string;
readonly joinBody?: string;
readonly joinJoin?: string;
readonly headerJoin?: string;
readonly bodyRight?: string;
readonly bodyLeft?: string;
readonly bodyJoin?: string;
};
export declare type BorderConfig = Required<BorderUserConfig>;
export declare type Alignment = 'center' | 'justify' | 'left' | 'right';
export declare type VerticalAlignment = 'bottom' | 'middle' | 'top';
export declare type ColumnUserConfig = {
/**
* Cell content horizontal alignment (default: left)
*/
readonly alignment?: Alignment;
/**
* Cell content vertical alignment (default: top)
*/
readonly verticalAlignment?: VerticalAlignment;
/**
* Column width (default: auto calculation based on the cell content)
*/
readonly width?: number;
/**
* Number of characters are which the content will be truncated (default: Infinity)
*/
readonly truncate?: number;
/**
* Cell content padding width left (default: 1)
*/
readonly paddingLeft?: number;
/**
* Cell content padding width right (default: 1)
*/
readonly paddingRight?: number;
/**
* If true, the text is broken at the nearest space or one of the special characters: "\|/_.,;-"
*/
readonly wrapWord?: boolean;
};
export declare type HeaderUserConfig = Omit<ColumnUserConfig, 'verticalAlignment' | 'width'> & {
readonly content: string;
};
export declare type BaseUserConfig = {
/**
* Custom border
*/
readonly border?: BorderUserConfig;
/**
* Default values for all columns. Column specific settings overwrite the default values.
*/
readonly columnDefault?: ColumnUserConfig;
/**
* Column specific configuration.
*/
readonly columns?: Indexable<ColumnUserConfig>;
/**
* Used to tell whether to draw a vertical line.
* This callback is called for each non-content line of the table.
* The default behavior is to always return true.
*/
readonly drawVerticalLine?: DrawVerticalLine;
};
export declare type TableUserConfig = BaseUserConfig & {
/**
* The header configuration
*/
readonly header?: HeaderUserConfig;
/**
* 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.
*/
readonly drawHorizontalLine?: DrawHorizontalLine;
/**
* Horizontal lines inside the table are not drawn.
*/
readonly singleLine?: boolean;
};
export declare type StreamUserConfig = BaseUserConfig & {
/**
* The number of columns
*/
readonly columnCount: number;
/**
* Default values for all columns. Column specific settings overwrite the default values.
*/
readonly columnDefault: ColumnUserConfig & {
/**
* The default width for each column
*/
readonly width: number;
};
};
export declare type WritableStream = {
readonly write: (rows: string[]) => void;
};
export declare type Indexable<T> = {
readonly [index: number]: T;
};

2
node_modules/table/dist/types/api.js generated vendored Normal file
View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

1
node_modules/table/dist/types/internal.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
export {};

2
node_modules/table/dist/types/internal.js generated vendored Normal file
View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

1
node_modules/table/dist/utils.d.ts generated vendored Normal file
View file

@ -0,0 +1 @@
export {};

92
node_modules/table/dist/utils.js generated vendored Normal file
View file

@ -0,0 +1,92 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.distributeUnevenly = exports.countSpaceSequence = exports.groupBySizes = exports.makeBorderConfig = exports.splitAnsi = exports.normalizeString = void 0;
const slice_ansi_1 = __importDefault(require("slice-ansi"));
const string_width_1 = __importDefault(require("string-width"));
const strip_ansi_1 = __importDefault(require("strip-ansi"));
const getBorderCharacters_1 = require("./getBorderCharacters");
/**
* Converts Windows-style newline to Unix-style
*
* @internal
*/
const normalizeString = (input) => {
return input.replace(/\r\n/g, '\n');
};
exports.normalizeString = normalizeString;
/**
* Splits ansi string by newlines
*
* @internal
*/
const splitAnsi = (input) => {
const lengths = strip_ansi_1.default(input).split('\n').map(string_width_1.default);
const result = [];
let startIndex = 0;
lengths.forEach((length) => {
result.push(length === 0 ? '' : slice_ansi_1.default(input, startIndex, startIndex + length));
// Plus 1 for the newline character itself
startIndex += length + 1;
});
return result;
};
exports.splitAnsi = splitAnsi;
/**
* Merges user provided border characters with the default border ("honeywell") characters.
*
* @internal
*/
const makeBorderConfig = (border) => {
return {
...getBorderCharacters_1.getBorderCharacters('honeywell'),
...border,
};
};
exports.makeBorderConfig = makeBorderConfig;
/**
* Groups the array into sub-arrays by sizes.
*
* @internal
* @example
* groupBySizes(['a', 'b', 'c', 'd', 'e'], [2, 1, 2]) = [ ['a', 'b'], ['c'], ['d', 'e'] ]
*/
const groupBySizes = (array, sizes) => {
let startIndex = 0;
return sizes.map((size) => {
const group = array.slice(startIndex, startIndex + size);
startIndex += size;
return group;
});
};
exports.groupBySizes = groupBySizes;
/**
* Counts the number of continuous spaces in a string
*
* @internal
* @example
* countGroupSpaces('a bc de f') = 3
*/
const countSpaceSequence = (input) => {
var _a, _b;
return (_b = (_a = input.match(/\s+/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
};
exports.countSpaceSequence = countSpaceSequence;
/**
* Creates the non-increasing number array given sum and length
* whose the difference between maximum and minimum is not greater than 1
*
* @internal
* @example
* distributeUnevenly(6, 3) = [2, 2, 2]
* distributeUnevenly(8, 3) = [3, 3, 2]
*/
const distributeUnevenly = (sum, length) => {
const result = Array.from({ length }).fill(Math.floor(sum / length));
return result.map((element, index) => {
return element + (index < sum % length ? 1 : 0);
});
};
exports.distributeUnevenly = distributeUnevenly;

2
node_modules/table/dist/validateConfig.d.ts generated vendored Normal file
View file

@ -0,0 +1,2 @@
import type { TableUserConfig } from './types/api';
export declare const validateConfig: (schemaId: 'config.json' | 'streamConfig.json', config: TableUserConfig) => void;

View file

@ -1,752 +1,25 @@
'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.hasOwnProperty(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 (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 ((data && typeof data === "object" && !Array.isArray(data))) {
var errs__0 = errors;
var valid1 = true;
for (var key0 in data) {
var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight');
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;
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;
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++;
}
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'; /*# sourceURL=config.json */
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;
valid1 = typeof data.drawHorizontalLine == "function";
if (!valid1) {
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-07/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"
}
}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
validate.errors = null;
module.exports = validate;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateConfig = void 0;
const validators_1 = __importDefault(require("./generated/validators"));
const validateConfig = (schemaId, config) => {
const validate = validators_1.default[schemaId];
if (!validate(config) && validate.errors) {
const errors = validate.errors.map((error) => {
return {
message: error.message,
params: error.params,
schemaPath: error.schemaPath,
};
});
/* eslint-disable no-console */
console.log('config', config);
console.log('errors', errors);
/* eslint-enable no-console */
throw new Error('Invalid config.');
}
};
exports.validateConfig = validateConfig;

View file

@ -1,34 +0,0 @@
// eslint-disable-next-line import/default
import validateConfig from '../dist/validateConfig';
// eslint-disable-next-line import/default
import validateStreamConfig from '../dist/validateStreamConfig';
const validate = {
'config.json': validateConfig,
'streamConfig.json': validateStreamConfig
};
/**
* @param {string} schemaId
* @param {formatData~config} config
* @returns {undefined}
*/
export default (schemaId, config = {}) => {
if (!validate[schemaId](config)) {
const errors = validate[schemaId].errors.map((error) => {
return {
dataPath: error.dataPath,
message: error.message,
params: error.params,
schemaPath: error.schemaPath
};
});
/* eslint-disable no-console */
console.log('config', config);
console.log('errors', errors);
/* eslint-enable no-console */
throw new Error('Invalid config.');
}
};

View file

@ -1 +0,0 @@
{"version":3,"sources":["../src/validateConfig.js"],"names":["validate","validateConfig","validateStreamConfig","schemaId","config","errors","map","error","dataPath","message","params","schemaPath","console","log","Error"],"mappings":";;;;;;;AACA;;AAEA;;;;AAHA;AAEA;AAGA,MAAMA,QAAQ,GAAG;AACf,iBAAeC,uBADA;AAEf,uBAAqBC;AAFN,CAAjB;AAKA;;;;;;yBAKgBC,Q,EAAUC,MAAM,GAAG,E,KAAO;AACxC,MAAI,CAACJ,QAAQ,CAACG,QAAD,CAAR,CAAmBC,MAAnB,CAAL,EAAiC;AAC/B,UAAMC,MAAM,GAAGL,QAAQ,CAACG,QAAD,CAAR,CAAmBE,MAAnB,CAA0BC,GAA1B,CAA+BC,KAAD,IAAW;AACtD,aAAO;AACLC,QAAAA,QAAQ,EAAED,KAAK,CAACC,QADX;AAELC,QAAAA,OAAO,EAAEF,KAAK,CAACE,OAFV;AAGLC,QAAAA,MAAM,EAAEH,KAAK,CAACG,MAHT;AAILC,QAAAA,UAAU,EAAEJ,KAAK,CAACI;AAJb,OAAP;AAMD,KAPc,CAAf;AASA;;AACAC,IAAAA,OAAO,CAACC,GAAR,CAAY,QAAZ,EAAsBT,MAAtB;AACAQ,IAAAA,OAAO,CAACC,GAAR,CAAY,QAAZ,EAAsBR,MAAtB;AACA;;AAEA,UAAM,IAAIS,KAAJ,CAAU,iBAAV,CAAN;AACD;AACF,C","sourcesContent":["// eslint-disable-next-line import/default\nimport validateConfig from '../dist/validateConfig';\n// eslint-disable-next-line import/default\nimport validateStreamConfig from '../dist/validateStreamConfig';\n\nconst validate = {\n 'config.json': validateConfig,\n 'streamConfig.json': validateStreamConfig\n};\n\n/**\n * @param {string} schemaId\n * @param {formatData~config} config\n * @returns {undefined}\n */\nexport default (schemaId, config = {}) => {\n if (!validate[schemaId](config)) {\n const errors = validate[schemaId].errors.map((error) => {\n return {\n dataPath: error.dataPath,\n message: error.message,\n params: error.params,\n schemaPath: error.schemaPath\n };\n });\n\n /* eslint-disable no-console */\n console.log('config', config);\n console.log('errors', errors);\n /* eslint-enable no-console */\n\n throw new Error('Invalid config.');\n }\n};\n"],"file":"validateConfig.js"}

Some files were not shown because too many files have changed in this diff Show more