table 4.0.3 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +10 -6
- package/dist/alignString.js +20 -20
- package/dist/alignString.js.flow +96 -0
- package/dist/alignString.js.map +1 -0
- package/dist/alignTableData.js +12 -11
- package/dist/alignTableData.js.flow +21 -0
- package/dist/alignTableData.js.map +1 -0
- package/dist/calculateCellHeight.js +14 -17
- package/dist/calculateCellHeight.js.flow +29 -0
- package/dist/calculateCellHeight.js.map +1 -0
- package/dist/calculateCellWidthIndex.js +10 -7
- package/dist/calculateCellWidthIndex.js.flow +13 -0
- package/dist/calculateCellWidthIndex.js.map +1 -0
- package/dist/calculateMaximumColumnWidthIndex.js +11 -11
- package/dist/calculateMaximumColumnWidthIndex.js.flow +27 -0
- package/dist/calculateMaximumColumnWidthIndex.js.map +1 -0
- package/dist/calculateRowHeightIndex.js +15 -19
- package/dist/calculateRowHeightIndex.js.flow +35 -0
- package/dist/calculateRowHeightIndex.js.map +1 -0
- package/dist/createStream.js +35 -68
- package/dist/createStream.js.flow +124 -0
- package/dist/createStream.js.map +1 -0
- package/dist/drawBorder.js +16 -8
- package/dist/drawBorder.js.flow +95 -0
- package/dist/drawBorder.js.map +1 -0
- package/dist/drawRow.js +8 -3
- package/dist/drawRow.js.flow +15 -0
- package/dist/drawRow.js.map +1 -0
- package/dist/drawTable.js +11 -12
- package/dist/drawTable.js.flow +52 -0
- package/dist/drawTable.js.map +1 -0
- package/dist/getBorderCharacters.js +8 -15
- package/dist/getBorderCharacters.js.flow +120 -0
- package/dist/getBorderCharacters.js.map +1 -0
- package/dist/index.js +23 -15
- package/dist/index.js.flow +9 -0
- package/dist/index.js.map +1 -0
- package/dist/makeConfig.js +21 -30
- package/dist/makeConfig.js.flow +72 -0
- package/dist/makeConfig.js.map +1 -0
- package/dist/makeStreamConfig.js +19 -27
- package/dist/makeStreamConfig.js.flow +83 -0
- package/dist/makeStreamConfig.js.map +1 -0
- package/dist/mapDataUsingRowHeightIndex.js +17 -22
- package/dist/mapDataUsingRowHeightIndex.js.flow +41 -0
- package/dist/mapDataUsingRowHeightIndex.js.map +1 -0
- package/dist/padTableData.js +8 -4
- package/dist/padTableData.js.flow +14 -0
- package/dist/padTableData.js.map +1 -0
- package/dist/schemas/config.json +1 -1
- package/dist/schemas/streamConfig.json +1 -1
- package/dist/stringifyTableData.js +7 -2
- package/dist/stringifyTableData.js.flow +11 -0
- package/dist/stringifyTableData.js.map +1 -0
- package/dist/table.js +29 -53
- package/dist/table.js.flow +95 -0
- package/dist/table.js.map +1 -0
- package/dist/truncateTableData.js +10 -7
- package/dist/truncateTableData.js.flow +17 -0
- package/dist/truncateTableData.js.map +1 -0
- package/dist/validateConfig.js +4 -5
- package/dist/validateConfig.js.flow +34 -0
- package/dist/validateConfig.js.map +1 -0
- package/dist/validateStreamConfig.js +4 -5
- package/dist/validateTableData.js +62 -15
- package/dist/validateTableData.js.flow +46 -0
- package/dist/validateTableData.js.map +1 -0
- package/dist/wrapString.js +13 -15
- package/dist/wrapString.js.flow +29 -0
- package/dist/wrapString.js.map +1 -0
- package/dist/wrapWord.js +15 -20
- package/dist/wrapWord.js.flow +39 -0
- package/dist/wrapWord.js.map +1 -0
- package/package.json +42 -30
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import getBorderCharacters from './getBorderCharacters';
|
|
3
|
+
import validateConfig from './validateConfig';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Merges user provided border characters with the default border ("honeywell") characters.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} border
|
|
9
|
+
* @returns {Object}
|
|
10
|
+
*/
|
|
11
|
+
const makeBorder = (border = {}) => {
|
|
12
|
+
return Object.assign({}, getBorderCharacters('honeywell'), border);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates a configuration for every column using default
|
|
17
|
+
* values for the missing configuration properties.
|
|
18
|
+
*
|
|
19
|
+
* @param {number} columnCount
|
|
20
|
+
* @param {Object} columns
|
|
21
|
+
* @param {Object} columnDefault
|
|
22
|
+
* @returns {Object}
|
|
23
|
+
*/
|
|
24
|
+
const makeColumns = (columnCount, columns = {}, columnDefault = {}) => {
|
|
25
|
+
_.times(columnCount, (index) => {
|
|
26
|
+
if (_.isUndefined(columns[index])) {
|
|
27
|
+
columns[index] = {};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
columns[index] = Object.assign({
|
|
31
|
+
alignment: 'left',
|
|
32
|
+
paddingLeft: 1,
|
|
33
|
+
paddingRight: 1,
|
|
34
|
+
truncate: Infinity,
|
|
35
|
+
wrapWord: false
|
|
36
|
+
}, columnDefault, columns[index]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return columns;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {Object} columnConfig
|
|
44
|
+
* @property {string} alignment
|
|
45
|
+
* @property {number} width
|
|
46
|
+
* @property {number} truncate
|
|
47
|
+
* @property {number} paddingLeft
|
|
48
|
+
* @property {number} paddingRight
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @typedef {Object} streamConfig
|
|
53
|
+
* @property {columnConfig} columnDefault
|
|
54
|
+
* @property {Object} border
|
|
55
|
+
* @property {columnConfig[]}
|
|
56
|
+
* @property {number} columnCount Number of columns in the table (required).
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Makes a new configuration object out of the userConfig object
|
|
61
|
+
* using default values for the missing configuration properties.
|
|
62
|
+
*
|
|
63
|
+
* @param {streamConfig} userConfig
|
|
64
|
+
* @returns {Object}
|
|
65
|
+
*/
|
|
66
|
+
export default (userConfig = {}) => {
|
|
67
|
+
validateConfig('streamConfig.json', userConfig);
|
|
68
|
+
|
|
69
|
+
const config = _.cloneDeep(userConfig);
|
|
70
|
+
|
|
71
|
+
if (!config.columnDefault || !config.columnDefault.width) {
|
|
72
|
+
throw new Error('Must provide config.columnDefault.width when creating a stream.');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!config.columnCount) {
|
|
76
|
+
throw new Error('Must provide config.columnCount.');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
config.border = makeBorder(config.border);
|
|
80
|
+
config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);
|
|
81
|
+
|
|
82
|
+
return config;
|
|
83
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/makeStreamConfig.js"],"names":["makeBorder","border","Object","assign","makeColumns","columnCount","columns","columnDefault","_","times","index","isUndefined","alignment","paddingLeft","paddingRight","truncate","Infinity","wrapWord","userConfig","config","cloneDeep","width","Error"],"mappings":";;;;;;;AAAA;;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;AACrEC,kBAAEC,KAAF,CAAQJ,WAAR,EAAsBK,KAAD,IAAW;AAC9B,QAAIF,gBAAEG,WAAF,CAAcL,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;AAC7BS,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,EAMdV,aANc,EAMCD,OAAO,CAACI,KAAD,CANR,CAAjB;AAOD,GAZD;;AAcA,SAAOJ,OAAP;AACD,CAhBD;AAkBA;;;;;;;;;AASA;;;;;;;;AAQA;;;;;;;;;0BAOgBY,UAAU,GAAG,E,KAAO;AAClC,+BAAe,mBAAf,EAAoCA,UAApC;;AAEA,QAAMC,MAAM,GAAGX,gBAAEY,SAAF,CAAYF,UAAZ,CAAf;;AAEA,MAAI,CAACC,MAAM,CAACZ,aAAR,IAAyB,CAACY,MAAM,CAACZ,aAAP,CAAqBc,KAAnD,EAA0D;AACxD,UAAM,IAAIC,KAAJ,CAAU,iEAAV,CAAN;AACD;;AAED,MAAI,CAACH,MAAM,CAACd,WAAZ,EAAyB;AACvB,UAAM,IAAIiB,KAAJ,CAAU,kCAAV,CAAN;AACD;;AAEDH,EAAAA,MAAM,CAAClB,MAAP,GAAgBD,UAAU,CAACmB,MAAM,CAAClB,MAAR,CAA1B;AACAkB,EAAAA,MAAM,CAACb,OAAP,GAAiBF,WAAW,CAACe,MAAM,CAACd,WAAR,EAAqBc,MAAM,CAACb,OAA5B,EAAqCa,MAAM,CAACZ,aAA5C,CAA5B;AAEA,SAAOY,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"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = void 0;
|
|
6
7
|
|
|
7
|
-
var _lodash = require(
|
|
8
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
9
|
|
|
9
|
-
var
|
|
10
|
+
var _wrapString = _interopRequireDefault(require("./wrapString"));
|
|
10
11
|
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
var _wrapString2 = _interopRequireDefault(_wrapString);
|
|
14
|
-
|
|
15
|
-
var _wrapWord = require('./wrapWord');
|
|
16
|
-
|
|
17
|
-
var _wrapWord2 = _interopRequireDefault(_wrapWord);
|
|
12
|
+
var _wrapWord = _interopRequireDefault(require("./wrapWord"));
|
|
18
13
|
|
|
19
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
15
|
|
|
@@ -24,34 +19,34 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
24
19
|
* @param {Object} config
|
|
25
20
|
* @returns {Array}
|
|
26
21
|
*/
|
|
27
|
-
|
|
22
|
+
const mapDataUsingRowHeightIndex = (unmappedRows, rowHeightIndex, config) => {
|
|
28
23
|
const tableWidth = unmappedRows[0].length;
|
|
29
|
-
|
|
30
24
|
const mappedRows = unmappedRows.map((cells, index0) => {
|
|
31
|
-
const rowHeight =
|
|
32
|
-
return Array(tableWidth).fill('');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// rowHeight
|
|
25
|
+
const rowHeight = _lodash.default.times(rowHeightIndex[index0], () => {
|
|
26
|
+
return new Array(tableWidth).fill('');
|
|
27
|
+
}); // rowHeight
|
|
36
28
|
// [{row index within rowSaw; index2}]
|
|
37
29
|
// [{cell index within a virtual row; index1}]
|
|
38
30
|
|
|
31
|
+
|
|
39
32
|
cells.forEach((value, index1) => {
|
|
40
33
|
let chunkedValue;
|
|
41
34
|
|
|
42
35
|
if (config.columns[index1].wrapWord) {
|
|
43
|
-
chunkedValue = (0,
|
|
36
|
+
chunkedValue = (0, _wrapWord.default)(value, config.columns[index1].width);
|
|
44
37
|
} else {
|
|
45
|
-
chunkedValue = (0,
|
|
38
|
+
chunkedValue = (0, _wrapString.default)(value, config.columns[index1].width);
|
|
46
39
|
}
|
|
47
40
|
|
|
48
41
|
chunkedValue.forEach((part, index2) => {
|
|
49
42
|
rowHeight[index2][index1] = part;
|
|
50
43
|
});
|
|
51
44
|
});
|
|
52
|
-
|
|
53
45
|
return rowHeight;
|
|
54
46
|
});
|
|
47
|
+
return _lodash.default.flatten(mappedRows);
|
|
48
|
+
};
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
var _default = mapDataUsingRowHeightIndex;
|
|
51
|
+
exports.default = _default;
|
|
52
|
+
//# sourceMappingURL=mapDataUsingRowHeightIndex.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import wrapString from './wrapString';
|
|
3
|
+
import wrapWord from './wrapWord';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {Array} unmappedRows
|
|
7
|
+
* @param {number[]} rowHeightIndex
|
|
8
|
+
* @param {Object} config
|
|
9
|
+
* @returns {Array}
|
|
10
|
+
*/
|
|
11
|
+
export default (unmappedRows, rowHeightIndex, config) => {
|
|
12
|
+
const tableWidth = unmappedRows[0].length;
|
|
13
|
+
|
|
14
|
+
const mappedRows = unmappedRows.map((cells, index0) => {
|
|
15
|
+
const rowHeight = _.times(rowHeightIndex[index0], () => {
|
|
16
|
+
return new Array(tableWidth).fill('');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// rowHeight
|
|
20
|
+
// [{row index within rowSaw; index2}]
|
|
21
|
+
// [{cell index within a virtual row; index1}]
|
|
22
|
+
|
|
23
|
+
cells.forEach((value, index1) => {
|
|
24
|
+
let chunkedValue;
|
|
25
|
+
|
|
26
|
+
if (config.columns[index1].wrapWord) {
|
|
27
|
+
chunkedValue = wrapWord(value, config.columns[index1].width);
|
|
28
|
+
} else {
|
|
29
|
+
chunkedValue = wrapString(value, config.columns[index1].width);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
chunkedValue.forEach((part, index2) => {
|
|
33
|
+
rowHeight[index2][index1] = part;
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return rowHeight;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return _.flatten(mappedRows);
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mapDataUsingRowHeightIndex.js"],"names":["unmappedRows","rowHeightIndex","config","tableWidth","length","mappedRows","map","cells","index0","rowHeight","_","times","Array","fill","forEach","value","index1","chunkedValue","columns","wrapWord","width","part","index2","flatten"],"mappings":";;;;;;;AAAA;;AACA;;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,GAAGC,gBAAEC,KAAF,CAAQV,cAAc,CAACO,MAAD,CAAtB,EAAgC,MAAM;AACtD,aAAO,IAAII,KAAJ,CAAUT,UAAV,EAAsBU,IAAtB,CAA2B,EAA3B,CAAP;AACD,KAFiB,CAAlB,CADqD,CAKrD;AACA;AACA;;;AAEAN,IAAAA,KAAK,CAACO,OAAN,CAAc,CAACC,KAAD,EAAQC,MAAR,KAAmB;AAC/B,UAAIC,YAAJ;;AAEA,UAAIf,MAAM,CAACgB,OAAP,CAAeF,MAAf,EAAuBG,QAA3B,EAAqC;AACnCF,QAAAA,YAAY,GAAG,uBAASF,KAAT,EAAgBb,MAAM,CAACgB,OAAP,CAAeF,MAAf,EAAuBI,KAAvC,CAAf;AACD,OAFD,MAEO;AACLH,QAAAA,YAAY,GAAG,yBAAWF,KAAX,EAAkBb,MAAM,CAACgB,OAAP,CAAeF,MAAf,EAAuBI,KAAzC,CAAf;AACD;;AAEDH,MAAAA,YAAY,CAACH,OAAb,CAAqB,CAACO,IAAD,EAAOC,MAAP,KAAkB;AACrCb,QAAAA,SAAS,CAACa,MAAD,CAAT,CAAkBN,MAAlB,IAA4BK,IAA5B;AACD,OAFD;AAGD,KAZD;AAcA,WAAOZ,SAAP;AACD,GAxBkB,CAAnB;AA0BA,SAAOC,gBAAEa,OAAF,CAAUlB,UAAV,CAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport wrapString from './wrapString';\nimport wrapWord from './wrapWord';\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 let chunkedValue;\n\n if (config.columns[index1].wrapWord) {\n chunkedValue = wrapWord(value, config.columns[index1].width);\n } else {\n chunkedValue = wrapString(value, config.columns[index1].width);\n }\n\n chunkedValue.forEach((part, index2) => {\n rowHeight[index2][index1] = part;\n });\n });\n\n return rowHeight;\n });\n\n return _.flatten(mappedRows);\n};\n"],"file":"mapDataUsingRowHeightIndex.js"}
|
package/dist/padTableData.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = void 0;
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @param {table~row[]} rows
|
|
9
10
|
* @param {Object} config
|
|
10
11
|
* @returns {table~row[]}
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
const padTableData = (rows, config) => {
|
|
13
14
|
return rows.map(cells => {
|
|
14
15
|
return cells.map((value, index1) => {
|
|
15
16
|
const column = config.columns[index1];
|
|
16
|
-
|
|
17
17
|
return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight);
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
|
-
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var _default = padTableData;
|
|
23
|
+
exports.default = _default;
|
|
24
|
+
//# sourceMappingURL=padTableData.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {table~row[]} rows
|
|
3
|
+
* @param {Object} config
|
|
4
|
+
* @returns {table~row[]}
|
|
5
|
+
*/
|
|
6
|
+
export default (rows, config) => {
|
|
7
|
+
return rows.map((cells) => {
|
|
8
|
+
return cells.map((value, index1) => {
|
|
9
|
+
const column = config.columns[index1];
|
|
10
|
+
|
|
11
|
+
return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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"}
|
package/dist/schemas/config.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = void 0;
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Casts all cell values to a string.
|
|
@@ -10,8 +11,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
11
|
* @param {table~row[]} rows
|
|
11
12
|
* @returns {table~row[]}
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
const stringifyTableData = rows => {
|
|
14
15
|
return rows.map(cells => {
|
|
15
16
|
return cells.map(String);
|
|
16
17
|
});
|
|
17
|
-
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var _default = stringifyTableData;
|
|
21
|
+
exports.default = _default;
|
|
22
|
+
//# sourceMappingURL=stringifyTableData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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"}
|
package/dist/table.js
CHANGED
|
@@ -1,48 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = void 0;
|
|
6
7
|
|
|
7
|
-
var _drawTable = require(
|
|
8
|
+
var _drawTable = _interopRequireDefault(require("./drawTable"));
|
|
8
9
|
|
|
9
|
-
var
|
|
10
|
+
var _calculateCellWidthIndex = _interopRequireDefault(require("./calculateCellWidthIndex"));
|
|
10
11
|
|
|
11
|
-
var
|
|
12
|
+
var _makeConfig = _interopRequireDefault(require("./makeConfig"));
|
|
12
13
|
|
|
13
|
-
var
|
|
14
|
+
var _calculateRowHeightIndex = _interopRequireDefault(require("./calculateRowHeightIndex"));
|
|
14
15
|
|
|
15
|
-
var
|
|
16
|
+
var _mapDataUsingRowHeightIndex = _interopRequireDefault(require("./mapDataUsingRowHeightIndex"));
|
|
16
17
|
|
|
17
|
-
var
|
|
18
|
+
var _alignTableData = _interopRequireDefault(require("./alignTableData"));
|
|
18
19
|
|
|
19
|
-
var
|
|
20
|
+
var _padTableData = _interopRequireDefault(require("./padTableData"));
|
|
20
21
|
|
|
21
|
-
var
|
|
22
|
+
var _validateTableData = _interopRequireDefault(require("./validateTableData"));
|
|
22
23
|
|
|
23
|
-
var
|
|
24
|
+
var _stringifyTableData = _interopRequireDefault(require("./stringifyTableData"));
|
|
24
25
|
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
var _alignTableData = require('./alignTableData');
|
|
28
|
-
|
|
29
|
-
var _alignTableData2 = _interopRequireDefault(_alignTableData);
|
|
30
|
-
|
|
31
|
-
var _padTableData = require('./padTableData');
|
|
32
|
-
|
|
33
|
-
var _padTableData2 = _interopRequireDefault(_padTableData);
|
|
34
|
-
|
|
35
|
-
var _validateTableData = require('./validateTableData');
|
|
36
|
-
|
|
37
|
-
var _validateTableData2 = _interopRequireDefault(_validateTableData);
|
|
38
|
-
|
|
39
|
-
var _stringifyTableData = require('./stringifyTableData');
|
|
40
|
-
|
|
41
|
-
var _stringifyTableData2 = _interopRequireDefault(_stringifyTableData);
|
|
42
|
-
|
|
43
|
-
var _truncateTableData = require('./truncateTableData');
|
|
44
|
-
|
|
45
|
-
var _truncateTableData2 = _interopRequireDefault(_truncateTableData);
|
|
26
|
+
var _truncateTableData = _interopRequireDefault(require("./truncateTableData"));
|
|
46
27
|
|
|
47
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
48
29
|
|
|
@@ -59,6 +40,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
59
40
|
* @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).
|
|
60
41
|
* @property {number} width Column width (default: auto).
|
|
61
42
|
* @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).
|
|
43
|
+
* @property {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters
|
|
62
44
|
* @property {number} paddingLeft Cell content padding width left (default: 1).
|
|
63
45
|
* @property {number} paddingRight Cell content padding width right (default: 1).
|
|
64
46
|
*/
|
|
@@ -108,26 +90,20 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
108
90
|
* @param {table~config} userConfig
|
|
109
91
|
* @returns {string}
|
|
110
92
|
*/
|
|
111
|
-
|
|
112
|
-
let userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
113
|
-
|
|
93
|
+
const table = (data, userConfig = {}) => {
|
|
114
94
|
let rows;
|
|
115
|
-
|
|
116
|
-
(0,
|
|
117
|
-
|
|
118
|
-
rows = (0,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
rows = (0,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const cellWidthIndex = (0, _calculateCellWidthIndex2.default)(rows[0]);
|
|
131
|
-
|
|
132
|
-
return (0, _drawTable2.default)(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine);
|
|
133
|
-
};
|
|
95
|
+
(0, _validateTableData.default)(data);
|
|
96
|
+
rows = (0, _stringifyTableData.default)(data);
|
|
97
|
+
const config = (0, _makeConfig.default)(rows, userConfig);
|
|
98
|
+
rows = (0, _truncateTableData.default)(data, config);
|
|
99
|
+
const rowHeightIndex = (0, _calculateRowHeightIndex.default)(rows, config);
|
|
100
|
+
rows = (0, _mapDataUsingRowHeightIndex.default)(rows, rowHeightIndex, config);
|
|
101
|
+
rows = (0, _alignTableData.default)(rows, config);
|
|
102
|
+
rows = (0, _padTableData.default)(rows, config);
|
|
103
|
+
const cellWidthIndex = (0, _calculateCellWidthIndex.default)(rows[0]);
|
|
104
|
+
return (0, _drawTable.default)(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
var _default = table;
|
|
108
|
+
exports.default = _default;
|
|
109
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import drawTable from './drawTable';
|
|
2
|
+
import calculateCellWidthIndex from './calculateCellWidthIndex';
|
|
3
|
+
import makeConfig from './makeConfig';
|
|
4
|
+
import calculateRowHeightIndex from './calculateRowHeightIndex';
|
|
5
|
+
import mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex';
|
|
6
|
+
import alignTableData from './alignTableData';
|
|
7
|
+
import padTableData from './padTableData';
|
|
8
|
+
import validateTableData from './validateTableData';
|
|
9
|
+
import stringifyTableData from './stringifyTableData';
|
|
10
|
+
import truncateTableData from './truncateTableData';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {string} table~cell
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {table~cell[]} table~row
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Object} table~columns
|
|
22
|
+
* @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).
|
|
23
|
+
* @property {number} width Column width (default: auto).
|
|
24
|
+
* @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).
|
|
25
|
+
* @property {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters
|
|
26
|
+
* @property {number} paddingLeft Cell content padding width left (default: 1).
|
|
27
|
+
* @property {number} paddingRight Cell content padding width right (default: 1).
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {Object} table~border
|
|
32
|
+
* @property {string} topBody
|
|
33
|
+
* @property {string} topJoin
|
|
34
|
+
* @property {string} topLeft
|
|
35
|
+
* @property {string} topRight
|
|
36
|
+
* @property {string} bottomBody
|
|
37
|
+
* @property {string} bottomJoin
|
|
38
|
+
* @property {string} bottomLeft
|
|
39
|
+
* @property {string} bottomRight
|
|
40
|
+
* @property {string} bodyLeft
|
|
41
|
+
* @property {string} bodyRight
|
|
42
|
+
* @property {string} bodyJoin
|
|
43
|
+
* @property {string} joinBody
|
|
44
|
+
* @property {string} joinLeft
|
|
45
|
+
* @property {string} joinRight
|
|
46
|
+
* @property {string} joinJoin
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Used to tell whether to draw a horizontal line.
|
|
51
|
+
* This callback is called for each non-content line of the table.
|
|
52
|
+
* The default behavior is to always return true.
|
|
53
|
+
*
|
|
54
|
+
* @typedef {Function} drawHorizontalLine
|
|
55
|
+
* @param {number} index
|
|
56
|
+
* @param {number} size
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {Object} table~config
|
|
62
|
+
* @property {table~border} border
|
|
63
|
+
* @property {table~columns[]} columns Column specific configuration.
|
|
64
|
+
* @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.
|
|
65
|
+
* @property {table~drawHorizontalLine} drawHorizontalLine
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Generates a text table.
|
|
70
|
+
*
|
|
71
|
+
* @param {table~row[]} data
|
|
72
|
+
* @param {table~config} userConfig
|
|
73
|
+
* @returns {string}
|
|
74
|
+
*/
|
|
75
|
+
export default (data, userConfig = {}) => {
|
|
76
|
+
let rows;
|
|
77
|
+
|
|
78
|
+
validateTableData(data);
|
|
79
|
+
|
|
80
|
+
rows = stringifyTableData(data);
|
|
81
|
+
|
|
82
|
+
const config = makeConfig(rows, userConfig);
|
|
83
|
+
|
|
84
|
+
rows = truncateTableData(data, config);
|
|
85
|
+
|
|
86
|
+
const rowHeightIndex = calculateRowHeightIndex(rows, config);
|
|
87
|
+
|
|
88
|
+
rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config);
|
|
89
|
+
rows = alignTableData(rows, config);
|
|
90
|
+
rows = padTableData(rows, config);
|
|
91
|
+
|
|
92
|
+
const cellWidthIndex = calculateCellWidthIndex(rows[0]);
|
|
93
|
+
|
|
94
|
+
return drawTable(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine);
|
|
95
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/table.js"],"names":["data","userConfig","rows","config","rowHeightIndex","cellWidthIndex","border","drawHorizontalLine"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA;;;;AAIA;;;;AAIA;;;;;;;;;;AAUA;;;;;;;;;;;;;;;;;;;AAmBA;;;;;;;;;;;AAWA;;;;;;;;AAQA;;;;;;;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,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 */\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);\n};\n"],"file":"table.js"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.default = void 0;
|
|
6
7
|
|
|
7
|
-
var _lodash = require(
|
|
8
|
-
|
|
9
|
-
var _lodash2 = _interopRequireDefault(_lodash);
|
|
8
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
9
|
|
|
11
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
11
|
|
|
@@ -16,12 +15,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
16
15
|
* @param {Object} config
|
|
17
16
|
* @returns {table~row[]}
|
|
18
17
|
*/
|
|
19
|
-
|
|
18
|
+
const truncateTableData = (rows, config) => {
|
|
20
19
|
return rows.map(cells => {
|
|
21
20
|
return cells.map((content, index) => {
|
|
22
|
-
return
|
|
21
|
+
return _lodash.default.truncate(content, {
|
|
23
22
|
length: config.columns[index].truncate
|
|
24
23
|
});
|
|
25
24
|
});
|
|
26
25
|
});
|
|
27
|
-
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var _default = truncateTableData;
|
|
29
|
+
exports.default = _default;
|
|
30
|
+
//# sourceMappingURL=truncateTableData.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @todo Make it work with ASCII content.
|
|
5
|
+
* @param {table~row[]} rows
|
|
6
|
+
* @param {Object} config
|
|
7
|
+
* @returns {table~row[]}
|
|
8
|
+
*/
|
|
9
|
+
export default (rows, config) => {
|
|
10
|
+
return rows.map((cells) => {
|
|
11
|
+
return cells.map((content, index) => {
|
|
12
|
+
return _.truncate(content, {
|
|
13
|
+
length: config.columns[index].truncate
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/truncateTableData.js"],"names":["rows","config","map","cells","content","index","_","truncate","length","columns"],"mappings":";;;;;;;AAAA;;;;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,aAAOC,gBAAEC,QAAF,CAAWH,OAAX,EAAoB;AACzBI,QAAAA,MAAM,EAAEP,MAAM,CAACQ,OAAP,CAAeJ,KAAf,EAAsBE;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"}
|
package/dist/validateConfig.js
CHANGED
|
@@ -14,7 +14,7 @@ var validate = (function() {
|
|
|
14
14
|
var errs__0 = errors;
|
|
15
15
|
var valid1 = true;
|
|
16
16
|
for (var key0 in data) {
|
|
17
|
-
var isAdditional0 = !(false || validate.schema.properties
|
|
17
|
+
var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0));
|
|
18
18
|
if (isAdditional0) {
|
|
19
19
|
valid1 = false;
|
|
20
20
|
var err = {
|
|
@@ -344,7 +344,7 @@ var validate = (function() {
|
|
|
344
344
|
var errs__0 = errors;
|
|
345
345
|
var valid1 = true;
|
|
346
346
|
for (var key0 in data) {
|
|
347
|
-
var isAdditional0 = !(false ||
|
|
347
|
+
var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight');
|
|
348
348
|
if (isAdditional0) {
|
|
349
349
|
valid1 = false;
|
|
350
350
|
var err = {
|
|
@@ -385,8 +385,7 @@ var validate = (function() {
|
|
|
385
385
|
if (equal(data1, schema1[i1])) {
|
|
386
386
|
valid1 = true;
|
|
387
387
|
break;
|
|
388
|
-
}
|
|
389
|
-
if (!valid1) {
|
|
388
|
+
} if (!valid1) {
|
|
390
389
|
var err = {
|
|
391
390
|
keyword: 'enum',
|
|
392
391
|
dataPath: (dataPath || '') + '.alignment',
|
|
@@ -641,7 +640,7 @@ var validate = (function() {
|
|
|
641
640
|
})();
|
|
642
641
|
validate.schema = {
|
|
643
642
|
"$id": "config.json",
|
|
644
|
-
"$schema": "http://json-schema.org/draft-
|
|
643
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
645
644
|
"type": "object",
|
|
646
645
|
"properties": {
|
|
647
646
|
"border": {
|