table 3.7.10 → 4.0.1
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/README.md +34 -15
- package/dist/alignString.js +1 -3
- package/dist/alignTableData.js +1 -3
- package/dist/calculateCellHeight.js +2 -4
- package/dist/calculateCellWidthIndex.js +1 -3
- package/dist/calculateMaximumColumnWidthIndex.js +1 -3
- package/dist/calculateRowHeightIndex.js +1 -3
- package/dist/createStream.js +2 -4
- package/dist/drawRow.js +1 -3
- package/dist/drawTable.js +1 -3
- package/dist/getBorderCharacters.js +1 -3
- package/dist/index.js +4 -4
- package/dist/makeConfig.js +5 -7
- package/dist/makeStreamConfig.js +5 -7
- package/dist/mapDataUsingRowHeightIndex.js +1 -3
- package/dist/padTableData.js +1 -3
- package/dist/stringifyTableData.js +1 -3
- package/dist/table.js +2 -4
- package/dist/truncateTableData.js +1 -3
- package/dist/validateConfig.js +752 -58
- package/dist/validateStreamConfig.js +739 -50
- package/dist/validateTableData.js +1 -3
- package/dist/wrapString.js +1 -3
- package/dist/wrapWord.js +1 -3
- package/package.json +25 -7
- package/test/README/usage/basic.js +3 -1
- package/test/README/usage/cell_content_alignment.js +3 -1
- package/test/README/usage/column_width.js +3 -1
- package/test/README/usage/custom_border.js +3 -1
- package/test/README/usage/draw_horizontal_line.js +3 -1
- package/test/README/usage/moon_mission.js +3 -2
- package/test/README/usage/padding_cell_content.js +3 -1
- package/test/README/usage/predefined_border_templates.js +3 -2
- package/test/README/usage/text_truncating.js +3 -1
- package/test/README/usage/text_wrapping.js +3 -1
- package/test/config.js +43 -0
- package/test/configSamples.js +153 -0
- package/test/streamConfig.js +43 -0
- package/test/streamConfigSamples.js +151 -0
- package/test/wrapString.js +2 -2
- package/dist/alignString.js.map +0 -1
- package/dist/alignTableData.js.map +0 -1
- package/dist/calculateCellHeight.js.map +0 -1
- package/dist/calculateCellWidthIndex.js.map +0 -1
- package/dist/calculateMaximumColumnWidthIndex.js.map +0 -1
- package/dist/calculateRowHeightIndex.js.map +0 -1
- package/dist/createStream.js.map +0 -1
- package/dist/drawBorder.js.map +0 -1
- package/dist/drawRow.js.map +0 -1
- package/dist/drawTable.js.map +0 -1
- package/dist/getBorderCharacters.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/makeConfig.js.map +0 -1
- package/dist/makeStreamConfig.js.map +0 -1
- package/dist/mapDataUsingRowHeightIndex.js.map +0 -1
- package/dist/padTableData.js.map +0 -1
- package/dist/stringifyTableData.js.map +0 -1
- package/dist/table.js.map +0 -1
- package/dist/truncateTableData.js.map +0 -1
- package/dist/validateConfig.js.map +0 -1
- package/dist/validateStreamConfig.js.map +0 -1
- package/dist/validateTableData.js.map +0 -1
- package/dist/wrapString.js.map +0 -1
- package/dist/wrapWord.js.map +0 -1
|
@@ -1,53 +1,742 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
2
|
+
var equal = require('ajv/lib/compile/equal');
|
|
3
|
+
var validate = (function() {
|
|
4
|
+
var pattern0 = new RegExp('^[0-9]+$');
|
|
5
|
+
var refVal = [];
|
|
6
|
+
var refVal1 = (function() {
|
|
7
|
+
var pattern0 = new RegExp('^[0-9]+$');
|
|
8
|
+
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
|
9
|
+
'use strict';
|
|
10
|
+
var vErrors = null;
|
|
11
|
+
var errors = 0;
|
|
12
|
+
if (rootData === undefined) rootData = data;
|
|
13
|
+
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
|
14
|
+
var errs__0 = errors;
|
|
15
|
+
var valid1 = true;
|
|
16
|
+
for (var key0 in data) {
|
|
17
|
+
var isAdditional0 = !(false || validate.schema.properties[key0]);
|
|
18
|
+
if (isAdditional0) {
|
|
19
|
+
valid1 = false;
|
|
20
|
+
var err = {
|
|
21
|
+
keyword: 'additionalProperties',
|
|
22
|
+
dataPath: (dataPath || '') + "",
|
|
23
|
+
schemaPath: '#/additionalProperties',
|
|
24
|
+
params: {
|
|
25
|
+
additionalProperty: '' + key0 + ''
|
|
26
|
+
},
|
|
27
|
+
message: 'should NOT have additional properties'
|
|
28
|
+
};
|
|
29
|
+
if (vErrors === null) vErrors = [err];
|
|
30
|
+
else vErrors.push(err);
|
|
31
|
+
errors++;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (data.topBody !== undefined) {
|
|
35
|
+
var errs_1 = errors;
|
|
36
|
+
if (!refVal2(data.topBody, (dataPath || '') + '.topBody', data, 'topBody', rootData)) {
|
|
37
|
+
if (vErrors === null) vErrors = refVal2.errors;
|
|
38
|
+
else vErrors = vErrors.concat(refVal2.errors);
|
|
39
|
+
errors = vErrors.length;
|
|
40
|
+
}
|
|
41
|
+
var valid1 = errors === errs_1;
|
|
42
|
+
}
|
|
43
|
+
if (data.topJoin !== undefined) {
|
|
44
|
+
var errs_1 = errors;
|
|
45
|
+
if (!refVal[2](data.topJoin, (dataPath || '') + '.topJoin', data, 'topJoin', rootData)) {
|
|
46
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
47
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
48
|
+
errors = vErrors.length;
|
|
49
|
+
}
|
|
50
|
+
var valid1 = errors === errs_1;
|
|
51
|
+
}
|
|
52
|
+
if (data.topLeft !== undefined) {
|
|
53
|
+
var errs_1 = errors;
|
|
54
|
+
if (!refVal[2](data.topLeft, (dataPath || '') + '.topLeft', data, 'topLeft', rootData)) {
|
|
55
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
56
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
57
|
+
errors = vErrors.length;
|
|
58
|
+
}
|
|
59
|
+
var valid1 = errors === errs_1;
|
|
60
|
+
}
|
|
61
|
+
if (data.topRight !== undefined) {
|
|
62
|
+
var errs_1 = errors;
|
|
63
|
+
if (!refVal[2](data.topRight, (dataPath || '') + '.topRight', data, 'topRight', rootData)) {
|
|
64
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
65
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
66
|
+
errors = vErrors.length;
|
|
67
|
+
}
|
|
68
|
+
var valid1 = errors === errs_1;
|
|
69
|
+
}
|
|
70
|
+
if (data.bottomBody !== undefined) {
|
|
71
|
+
var errs_1 = errors;
|
|
72
|
+
if (!refVal[2](data.bottomBody, (dataPath || '') + '.bottomBody', data, 'bottomBody', rootData)) {
|
|
73
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
74
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
75
|
+
errors = vErrors.length;
|
|
76
|
+
}
|
|
77
|
+
var valid1 = errors === errs_1;
|
|
78
|
+
}
|
|
79
|
+
if (data.bottomJoin !== undefined) {
|
|
80
|
+
var errs_1 = errors;
|
|
81
|
+
if (!refVal[2](data.bottomJoin, (dataPath || '') + '.bottomJoin', data, 'bottomJoin', rootData)) {
|
|
82
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
83
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
84
|
+
errors = vErrors.length;
|
|
85
|
+
}
|
|
86
|
+
var valid1 = errors === errs_1;
|
|
87
|
+
}
|
|
88
|
+
if (data.bottomLeft !== undefined) {
|
|
89
|
+
var errs_1 = errors;
|
|
90
|
+
if (!refVal[2](data.bottomLeft, (dataPath || '') + '.bottomLeft', data, 'bottomLeft', rootData)) {
|
|
91
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
92
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
93
|
+
errors = vErrors.length;
|
|
94
|
+
}
|
|
95
|
+
var valid1 = errors === errs_1;
|
|
96
|
+
}
|
|
97
|
+
if (data.bottomRight !== undefined) {
|
|
98
|
+
var errs_1 = errors;
|
|
99
|
+
if (!refVal[2](data.bottomRight, (dataPath || '') + '.bottomRight', data, 'bottomRight', rootData)) {
|
|
100
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
101
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
102
|
+
errors = vErrors.length;
|
|
103
|
+
}
|
|
104
|
+
var valid1 = errors === errs_1;
|
|
105
|
+
}
|
|
106
|
+
if (data.bodyLeft !== undefined) {
|
|
107
|
+
var errs_1 = errors;
|
|
108
|
+
if (!refVal[2](data.bodyLeft, (dataPath || '') + '.bodyLeft', data, 'bodyLeft', rootData)) {
|
|
109
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
110
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
111
|
+
errors = vErrors.length;
|
|
112
|
+
}
|
|
113
|
+
var valid1 = errors === errs_1;
|
|
114
|
+
}
|
|
115
|
+
if (data.bodyRight !== undefined) {
|
|
116
|
+
var errs_1 = errors;
|
|
117
|
+
if (!refVal[2](data.bodyRight, (dataPath || '') + '.bodyRight', data, 'bodyRight', rootData)) {
|
|
118
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
119
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
120
|
+
errors = vErrors.length;
|
|
121
|
+
}
|
|
122
|
+
var valid1 = errors === errs_1;
|
|
123
|
+
}
|
|
124
|
+
if (data.bodyJoin !== undefined) {
|
|
125
|
+
var errs_1 = errors;
|
|
126
|
+
if (!refVal[2](data.bodyJoin, (dataPath || '') + '.bodyJoin', data, 'bodyJoin', rootData)) {
|
|
127
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
128
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
129
|
+
errors = vErrors.length;
|
|
130
|
+
}
|
|
131
|
+
var valid1 = errors === errs_1;
|
|
132
|
+
}
|
|
133
|
+
if (data.joinBody !== undefined) {
|
|
134
|
+
var errs_1 = errors;
|
|
135
|
+
if (!refVal[2](data.joinBody, (dataPath || '') + '.joinBody', data, 'joinBody', rootData)) {
|
|
136
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
137
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
138
|
+
errors = vErrors.length;
|
|
139
|
+
}
|
|
140
|
+
var valid1 = errors === errs_1;
|
|
141
|
+
}
|
|
142
|
+
if (data.joinLeft !== undefined) {
|
|
143
|
+
var errs_1 = errors;
|
|
144
|
+
if (!refVal[2](data.joinLeft, (dataPath || '') + '.joinLeft', data, 'joinLeft', rootData)) {
|
|
145
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
146
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
147
|
+
errors = vErrors.length;
|
|
148
|
+
}
|
|
149
|
+
var valid1 = errors === errs_1;
|
|
150
|
+
}
|
|
151
|
+
if (data.joinRight !== undefined) {
|
|
152
|
+
var errs_1 = errors;
|
|
153
|
+
if (!refVal[2](data.joinRight, (dataPath || '') + '.joinRight', data, 'joinRight', rootData)) {
|
|
154
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
155
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
156
|
+
errors = vErrors.length;
|
|
157
|
+
}
|
|
158
|
+
var valid1 = errors === errs_1;
|
|
159
|
+
}
|
|
160
|
+
if (data.joinJoin !== undefined) {
|
|
161
|
+
var errs_1 = errors;
|
|
162
|
+
if (!refVal[2](data.joinJoin, (dataPath || '') + '.joinJoin', data, 'joinJoin', rootData)) {
|
|
163
|
+
if (vErrors === null) vErrors = refVal[2].errors;
|
|
164
|
+
else vErrors = vErrors.concat(refVal[2].errors);
|
|
165
|
+
errors = vErrors.length;
|
|
166
|
+
}
|
|
167
|
+
var valid1 = errors === errs_1;
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
var err = {
|
|
171
|
+
keyword: 'type',
|
|
172
|
+
dataPath: (dataPath || '') + "",
|
|
173
|
+
schemaPath: '#/type',
|
|
174
|
+
params: {
|
|
175
|
+
type: 'object'
|
|
176
|
+
},
|
|
177
|
+
message: 'should be object'
|
|
178
|
+
};
|
|
179
|
+
if (vErrors === null) vErrors = [err];
|
|
180
|
+
else vErrors.push(err);
|
|
181
|
+
errors++;
|
|
182
|
+
}
|
|
183
|
+
validate.errors = vErrors;
|
|
184
|
+
return errors === 0;
|
|
185
|
+
};
|
|
186
|
+
})();
|
|
187
|
+
refVal1.schema = {
|
|
188
|
+
"type": "object",
|
|
189
|
+
"properties": {
|
|
190
|
+
"topBody": {
|
|
191
|
+
"$ref": "#/definitions/border"
|
|
192
|
+
},
|
|
193
|
+
"topJoin": {
|
|
194
|
+
"$ref": "#/definitions/border"
|
|
195
|
+
},
|
|
196
|
+
"topLeft": {
|
|
197
|
+
"$ref": "#/definitions/border"
|
|
198
|
+
},
|
|
199
|
+
"topRight": {
|
|
200
|
+
"$ref": "#/definitions/border"
|
|
201
|
+
},
|
|
202
|
+
"bottomBody": {
|
|
203
|
+
"$ref": "#/definitions/border"
|
|
204
|
+
},
|
|
205
|
+
"bottomJoin": {
|
|
206
|
+
"$ref": "#/definitions/border"
|
|
207
|
+
},
|
|
208
|
+
"bottomLeft": {
|
|
209
|
+
"$ref": "#/definitions/border"
|
|
210
|
+
},
|
|
211
|
+
"bottomRight": {
|
|
212
|
+
"$ref": "#/definitions/border"
|
|
213
|
+
},
|
|
214
|
+
"bodyLeft": {
|
|
215
|
+
"$ref": "#/definitions/border"
|
|
216
|
+
},
|
|
217
|
+
"bodyRight": {
|
|
218
|
+
"$ref": "#/definitions/border"
|
|
219
|
+
},
|
|
220
|
+
"bodyJoin": {
|
|
221
|
+
"$ref": "#/definitions/border"
|
|
222
|
+
},
|
|
223
|
+
"joinBody": {
|
|
224
|
+
"$ref": "#/definitions/border"
|
|
225
|
+
},
|
|
226
|
+
"joinLeft": {
|
|
227
|
+
"$ref": "#/definitions/border"
|
|
228
|
+
},
|
|
229
|
+
"joinRight": {
|
|
230
|
+
"$ref": "#/definitions/border"
|
|
231
|
+
},
|
|
232
|
+
"joinJoin": {
|
|
233
|
+
"$ref": "#/definitions/border"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"additionalProperties": false
|
|
237
|
+
};
|
|
238
|
+
refVal1.errors = null;
|
|
239
|
+
refVal[1] = refVal1;
|
|
240
|
+
var refVal2 = (function() {
|
|
241
|
+
var pattern0 = new RegExp('^[0-9]+$');
|
|
242
|
+
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
|
243
|
+
'use strict';
|
|
244
|
+
var vErrors = null;
|
|
245
|
+
var errors = 0;
|
|
246
|
+
if (rootData === undefined) rootData = data;
|
|
247
|
+
if (typeof data !== "string") {
|
|
248
|
+
var err = {
|
|
249
|
+
keyword: 'type',
|
|
250
|
+
dataPath: (dataPath || '') + "",
|
|
251
|
+
schemaPath: '#/type',
|
|
252
|
+
params: {
|
|
253
|
+
type: 'string'
|
|
254
|
+
},
|
|
255
|
+
message: 'should be string'
|
|
256
|
+
};
|
|
257
|
+
if (vErrors === null) vErrors = [err];
|
|
258
|
+
else vErrors.push(err);
|
|
259
|
+
errors++;
|
|
260
|
+
}
|
|
261
|
+
validate.errors = vErrors;
|
|
262
|
+
return errors === 0;
|
|
263
|
+
};
|
|
264
|
+
})();
|
|
265
|
+
refVal2.schema = {
|
|
266
|
+
"type": "string"
|
|
267
|
+
};
|
|
268
|
+
refVal2.errors = null;
|
|
269
|
+
refVal[2] = refVal2;
|
|
270
|
+
var refVal3 = (function() {
|
|
271
|
+
var pattern0 = new RegExp('^[0-9]+$');
|
|
272
|
+
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
|
273
|
+
'use strict';
|
|
274
|
+
var vErrors = null;
|
|
275
|
+
var errors = 0;
|
|
276
|
+
if (rootData === undefined) rootData = data;
|
|
277
|
+
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
|
278
|
+
var errs__0 = errors;
|
|
279
|
+
var valid1 = true;
|
|
280
|
+
for (var key0 in data) {
|
|
281
|
+
var isAdditional0 = !(false || pattern0.test(key0));
|
|
282
|
+
if (isAdditional0) {
|
|
283
|
+
valid1 = false;
|
|
284
|
+
var err = {
|
|
285
|
+
keyword: 'additionalProperties',
|
|
286
|
+
dataPath: (dataPath || '') + "",
|
|
287
|
+
schemaPath: '#/additionalProperties',
|
|
288
|
+
params: {
|
|
289
|
+
additionalProperty: '' + key0 + ''
|
|
290
|
+
},
|
|
291
|
+
message: 'should NOT have additional properties'
|
|
292
|
+
};
|
|
293
|
+
if (vErrors === null) vErrors = [err];
|
|
294
|
+
else vErrors.push(err);
|
|
295
|
+
errors++;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
for (var key0 in data) {
|
|
299
|
+
if (pattern0.test(key0)) {
|
|
300
|
+
var errs_1 = errors;
|
|
301
|
+
if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) {
|
|
302
|
+
if (vErrors === null) vErrors = refVal4.errors;
|
|
303
|
+
else vErrors = vErrors.concat(refVal4.errors);
|
|
304
|
+
errors = vErrors.length;
|
|
305
|
+
}
|
|
306
|
+
var valid1 = errors === errs_1;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
} else {
|
|
310
|
+
var err = {
|
|
311
|
+
keyword: 'type',
|
|
312
|
+
dataPath: (dataPath || '') + "",
|
|
313
|
+
schemaPath: '#/type',
|
|
314
|
+
params: {
|
|
315
|
+
type: 'object'
|
|
316
|
+
},
|
|
317
|
+
message: 'should be object'
|
|
318
|
+
};
|
|
319
|
+
if (vErrors === null) vErrors = [err];
|
|
320
|
+
else vErrors.push(err);
|
|
321
|
+
errors++;
|
|
322
|
+
}
|
|
323
|
+
validate.errors = vErrors;
|
|
324
|
+
return errors === 0;
|
|
325
|
+
};
|
|
326
|
+
})();
|
|
327
|
+
refVal3.schema = {
|
|
328
|
+
"type": "object",
|
|
329
|
+
"patternProperties": {
|
|
330
|
+
"^[0-9]+$": {
|
|
331
|
+
"$ref": "#/definitions/column"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
"additionalProperties": false
|
|
335
|
+
};
|
|
336
|
+
refVal3.errors = null;
|
|
337
|
+
refVal[3] = refVal3;
|
|
338
|
+
var refVal4 = (function() {
|
|
339
|
+
var pattern0 = new RegExp('^[0-9]+$');
|
|
340
|
+
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
|
341
|
+
'use strict';
|
|
342
|
+
var vErrors = null;
|
|
343
|
+
var errors = 0;
|
|
344
|
+
if (rootData === undefined) rootData = data;
|
|
345
|
+
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
|
346
|
+
var errs__0 = errors;
|
|
347
|
+
var valid1 = true;
|
|
348
|
+
for (var key0 in data) {
|
|
349
|
+
var isAdditional0 = !(false || validate.schema.properties[key0]);
|
|
350
|
+
if (isAdditional0) {
|
|
351
|
+
valid1 = false;
|
|
352
|
+
var err = {
|
|
353
|
+
keyword: 'additionalProperties',
|
|
354
|
+
dataPath: (dataPath || '') + "",
|
|
355
|
+
schemaPath: '#/additionalProperties',
|
|
356
|
+
params: {
|
|
357
|
+
additionalProperty: '' + key0 + ''
|
|
358
|
+
},
|
|
359
|
+
message: 'should NOT have additional properties'
|
|
360
|
+
};
|
|
361
|
+
if (vErrors === null) vErrors = [err];
|
|
362
|
+
else vErrors.push(err);
|
|
363
|
+
errors++;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
var data1 = data.alignment;
|
|
367
|
+
if (data1 !== undefined) {
|
|
368
|
+
var errs_1 = errors;
|
|
369
|
+
var schema1 = validate.schema.properties.alignment.enum;
|
|
370
|
+
var valid1;
|
|
371
|
+
valid1 = false;
|
|
372
|
+
for (var i1 = 0; i1 < schema1.length; i1++)
|
|
373
|
+
if (equal(data1, schema1[i1])) {
|
|
374
|
+
valid1 = true;
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
if (!valid1) {
|
|
378
|
+
var err = {
|
|
379
|
+
keyword: 'enum',
|
|
380
|
+
dataPath: (dataPath || '') + '.alignment',
|
|
381
|
+
schemaPath: '#/properties/alignment/enum',
|
|
382
|
+
params: {
|
|
383
|
+
allowedValues: schema1
|
|
384
|
+
},
|
|
385
|
+
message: 'should be equal to one of the allowed values'
|
|
386
|
+
};
|
|
387
|
+
if (vErrors === null) vErrors = [err];
|
|
388
|
+
else vErrors.push(err);
|
|
389
|
+
errors++;
|
|
390
|
+
}
|
|
391
|
+
if (typeof data1 !== "string") {
|
|
392
|
+
var err = {
|
|
393
|
+
keyword: 'type',
|
|
394
|
+
dataPath: (dataPath || '') + '.alignment',
|
|
395
|
+
schemaPath: '#/properties/alignment/type',
|
|
396
|
+
params: {
|
|
397
|
+
type: 'string'
|
|
398
|
+
},
|
|
399
|
+
message: 'should be string'
|
|
400
|
+
};
|
|
401
|
+
if (vErrors === null) vErrors = [err];
|
|
402
|
+
else vErrors.push(err);
|
|
403
|
+
errors++;
|
|
404
|
+
}
|
|
405
|
+
var valid1 = errors === errs_1;
|
|
406
|
+
}
|
|
407
|
+
if (data.width !== undefined) {
|
|
408
|
+
var errs_1 = errors;
|
|
409
|
+
if (typeof data.width !== "number") {
|
|
410
|
+
var err = {
|
|
411
|
+
keyword: 'type',
|
|
412
|
+
dataPath: (dataPath || '') + '.width',
|
|
413
|
+
schemaPath: '#/properties/width/type',
|
|
414
|
+
params: {
|
|
415
|
+
type: 'number'
|
|
416
|
+
},
|
|
417
|
+
message: 'should be number'
|
|
418
|
+
};
|
|
419
|
+
if (vErrors === null) vErrors = [err];
|
|
420
|
+
else vErrors.push(err);
|
|
421
|
+
errors++;
|
|
422
|
+
}
|
|
423
|
+
var valid1 = errors === errs_1;
|
|
424
|
+
}
|
|
425
|
+
if (data.wrapWord !== undefined) {
|
|
426
|
+
var errs_1 = errors;
|
|
427
|
+
if (typeof data.wrapWord !== "boolean") {
|
|
428
|
+
var err = {
|
|
429
|
+
keyword: 'type',
|
|
430
|
+
dataPath: (dataPath || '') + '.wrapWord',
|
|
431
|
+
schemaPath: '#/properties/wrapWord/type',
|
|
432
|
+
params: {
|
|
433
|
+
type: 'boolean'
|
|
434
|
+
},
|
|
435
|
+
message: 'should be boolean'
|
|
436
|
+
};
|
|
437
|
+
if (vErrors === null) vErrors = [err];
|
|
438
|
+
else vErrors.push(err);
|
|
439
|
+
errors++;
|
|
440
|
+
}
|
|
441
|
+
var valid1 = errors === errs_1;
|
|
442
|
+
}
|
|
443
|
+
if (data.truncate !== undefined) {
|
|
444
|
+
var errs_1 = errors;
|
|
445
|
+
if (typeof data.truncate !== "number") {
|
|
446
|
+
var err = {
|
|
447
|
+
keyword: 'type',
|
|
448
|
+
dataPath: (dataPath || '') + '.truncate',
|
|
449
|
+
schemaPath: '#/properties/truncate/type',
|
|
450
|
+
params: {
|
|
451
|
+
type: 'number'
|
|
452
|
+
},
|
|
453
|
+
message: 'should be number'
|
|
454
|
+
};
|
|
455
|
+
if (vErrors === null) vErrors = [err];
|
|
456
|
+
else vErrors.push(err);
|
|
457
|
+
errors++;
|
|
458
|
+
}
|
|
459
|
+
var valid1 = errors === errs_1;
|
|
460
|
+
}
|
|
461
|
+
if (data.paddingLeft !== undefined) {
|
|
462
|
+
var errs_1 = errors;
|
|
463
|
+
if (typeof data.paddingLeft !== "number") {
|
|
464
|
+
var err = {
|
|
465
|
+
keyword: 'type',
|
|
466
|
+
dataPath: (dataPath || '') + '.paddingLeft',
|
|
467
|
+
schemaPath: '#/properties/paddingLeft/type',
|
|
468
|
+
params: {
|
|
469
|
+
type: 'number'
|
|
470
|
+
},
|
|
471
|
+
message: 'should be number'
|
|
472
|
+
};
|
|
473
|
+
if (vErrors === null) vErrors = [err];
|
|
474
|
+
else vErrors.push(err);
|
|
475
|
+
errors++;
|
|
476
|
+
}
|
|
477
|
+
var valid1 = errors === errs_1;
|
|
478
|
+
}
|
|
479
|
+
if (data.paddingRight !== undefined) {
|
|
480
|
+
var errs_1 = errors;
|
|
481
|
+
if (typeof data.paddingRight !== "number") {
|
|
482
|
+
var err = {
|
|
483
|
+
keyword: 'type',
|
|
484
|
+
dataPath: (dataPath || '') + '.paddingRight',
|
|
485
|
+
schemaPath: '#/properties/paddingRight/type',
|
|
486
|
+
params: {
|
|
487
|
+
type: 'number'
|
|
488
|
+
},
|
|
489
|
+
message: 'should be number'
|
|
490
|
+
};
|
|
491
|
+
if (vErrors === null) vErrors = [err];
|
|
492
|
+
else vErrors.push(err);
|
|
493
|
+
errors++;
|
|
494
|
+
}
|
|
495
|
+
var valid1 = errors === errs_1;
|
|
496
|
+
}
|
|
497
|
+
} else {
|
|
498
|
+
var err = {
|
|
499
|
+
keyword: 'type',
|
|
500
|
+
dataPath: (dataPath || '') + "",
|
|
501
|
+
schemaPath: '#/type',
|
|
502
|
+
params: {
|
|
503
|
+
type: 'object'
|
|
504
|
+
},
|
|
505
|
+
message: 'should be object'
|
|
506
|
+
};
|
|
507
|
+
if (vErrors === null) vErrors = [err];
|
|
508
|
+
else vErrors.push(err);
|
|
509
|
+
errors++;
|
|
510
|
+
}
|
|
511
|
+
validate.errors = vErrors;
|
|
512
|
+
return errors === 0;
|
|
513
|
+
};
|
|
514
|
+
})();
|
|
515
|
+
refVal4.schema = {
|
|
516
|
+
"type": "object",
|
|
517
|
+
"properties": {
|
|
518
|
+
"alignment": {
|
|
519
|
+
"type": "string",
|
|
520
|
+
"enum": ["left", "right", "center"]
|
|
521
|
+
},
|
|
522
|
+
"width": {
|
|
523
|
+
"type": "number"
|
|
524
|
+
},
|
|
525
|
+
"wrapWord": {
|
|
526
|
+
"type": "boolean"
|
|
527
|
+
},
|
|
528
|
+
"truncate": {
|
|
529
|
+
"type": "number"
|
|
530
|
+
},
|
|
531
|
+
"paddingLeft": {
|
|
532
|
+
"type": "number"
|
|
533
|
+
},
|
|
534
|
+
"paddingRight": {
|
|
535
|
+
"type": "number"
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
"additionalProperties": false
|
|
539
|
+
};
|
|
540
|
+
refVal4.errors = null;
|
|
541
|
+
refVal[4] = refVal4;
|
|
542
|
+
return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
|
|
543
|
+
'use strict';
|
|
544
|
+
var vErrors = null;
|
|
545
|
+
var errors = 0;
|
|
546
|
+
if (rootData === undefined) rootData = data;
|
|
547
|
+
if ((data && typeof data === "object" && !Array.isArray(data))) {
|
|
548
|
+
var errs__0 = errors;
|
|
549
|
+
var valid1 = true;
|
|
550
|
+
for (var key0 in data) {
|
|
551
|
+
var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'columnCount');
|
|
552
|
+
if (isAdditional0) {
|
|
553
|
+
valid1 = false;
|
|
554
|
+
var err = {
|
|
555
|
+
keyword: 'additionalProperties',
|
|
556
|
+
dataPath: (dataPath || '') + "",
|
|
557
|
+
schemaPath: '#/additionalProperties',
|
|
558
|
+
params: {
|
|
559
|
+
additionalProperty: '' + key0 + ''
|
|
560
|
+
},
|
|
561
|
+
message: 'should NOT have additional properties'
|
|
562
|
+
};
|
|
563
|
+
if (vErrors === null) vErrors = [err];
|
|
564
|
+
else vErrors.push(err);
|
|
565
|
+
errors++;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
if (data.border !== undefined) {
|
|
569
|
+
var errs_1 = errors;
|
|
570
|
+
if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) {
|
|
571
|
+
if (vErrors === null) vErrors = refVal1.errors;
|
|
572
|
+
else vErrors = vErrors.concat(refVal1.errors);
|
|
573
|
+
errors = vErrors.length;
|
|
574
|
+
}
|
|
575
|
+
var valid1 = errors === errs_1;
|
|
576
|
+
}
|
|
577
|
+
if (data.columns !== undefined) {
|
|
578
|
+
var errs_1 = errors;
|
|
579
|
+
if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) {
|
|
580
|
+
if (vErrors === null) vErrors = refVal3.errors;
|
|
581
|
+
else vErrors = vErrors.concat(refVal3.errors);
|
|
582
|
+
errors = vErrors.length;
|
|
583
|
+
}
|
|
584
|
+
var valid1 = errors === errs_1;
|
|
585
|
+
}
|
|
586
|
+
if (data.columnDefault !== undefined) {
|
|
587
|
+
var errs_1 = errors;
|
|
588
|
+
if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) {
|
|
589
|
+
if (vErrors === null) vErrors = refVal[4].errors;
|
|
590
|
+
else vErrors = vErrors.concat(refVal[4].errors);
|
|
591
|
+
errors = vErrors.length;
|
|
592
|
+
}
|
|
593
|
+
var valid1 = errors === errs_1;
|
|
594
|
+
}
|
|
595
|
+
if (data.columnCount !== undefined) {
|
|
596
|
+
var errs_1 = errors;
|
|
597
|
+
if (typeof data.columnCount !== "number") {
|
|
598
|
+
var err = {
|
|
599
|
+
keyword: 'type',
|
|
600
|
+
dataPath: (dataPath || '') + '.columnCount',
|
|
601
|
+
schemaPath: '#/properties/columnCount/type',
|
|
602
|
+
params: {
|
|
603
|
+
type: 'number'
|
|
604
|
+
},
|
|
605
|
+
message: 'should be number'
|
|
606
|
+
};
|
|
607
|
+
if (vErrors === null) vErrors = [err];
|
|
608
|
+
else vErrors.push(err);
|
|
609
|
+
errors++;
|
|
610
|
+
}
|
|
611
|
+
var valid1 = errors === errs_1;
|
|
612
|
+
}
|
|
613
|
+
} else {
|
|
614
|
+
var err = {
|
|
615
|
+
keyword: 'type',
|
|
616
|
+
dataPath: (dataPath || '') + "",
|
|
617
|
+
schemaPath: '#/type',
|
|
618
|
+
params: {
|
|
619
|
+
type: 'object'
|
|
620
|
+
},
|
|
621
|
+
message: 'should be object'
|
|
622
|
+
};
|
|
623
|
+
if (vErrors === null) vErrors = [err];
|
|
624
|
+
else vErrors.push(err);
|
|
625
|
+
errors++;
|
|
49
626
|
}
|
|
627
|
+
validate.errors = vErrors;
|
|
628
|
+
return errors === 0;
|
|
629
|
+
};
|
|
630
|
+
})();
|
|
631
|
+
validate.schema = {
|
|
632
|
+
"id": "streamConfig.json",
|
|
633
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
634
|
+
"type": "object",
|
|
635
|
+
"properties": {
|
|
636
|
+
"border": {
|
|
637
|
+
"$ref": "#/definitions/borders"
|
|
638
|
+
},
|
|
639
|
+
"columns": {
|
|
640
|
+
"$ref": "#/definitions/columns"
|
|
641
|
+
},
|
|
642
|
+
"columnDefault": {
|
|
643
|
+
"$ref": "#/definitions/column"
|
|
644
|
+
},
|
|
645
|
+
"columnCount": {
|
|
646
|
+
"type": "number"
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
"additionalProperties": false,
|
|
650
|
+
"definitions": {
|
|
651
|
+
"columns": {
|
|
652
|
+
"type": "object",
|
|
653
|
+
"patternProperties": {
|
|
654
|
+
"^[0-9]+$": {
|
|
655
|
+
"$ref": "#/definitions/column"
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
"additionalProperties": false
|
|
659
|
+
},
|
|
660
|
+
"column": {
|
|
661
|
+
"type": "object",
|
|
662
|
+
"properties": {
|
|
663
|
+
"alignment": {
|
|
664
|
+
"type": "string",
|
|
665
|
+
"enum": ["left", "right", "center"]
|
|
666
|
+
},
|
|
667
|
+
"width": {
|
|
668
|
+
"type": "number"
|
|
669
|
+
},
|
|
670
|
+
"wrapWord": {
|
|
671
|
+
"type": "boolean"
|
|
672
|
+
},
|
|
673
|
+
"truncate": {
|
|
674
|
+
"type": "number"
|
|
675
|
+
},
|
|
676
|
+
"paddingLeft": {
|
|
677
|
+
"type": "number"
|
|
678
|
+
},
|
|
679
|
+
"paddingRight": {
|
|
680
|
+
"type": "number"
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
"additionalProperties": false
|
|
684
|
+
},
|
|
685
|
+
"borders": {
|
|
686
|
+
"type": "object",
|
|
687
|
+
"properties": {
|
|
688
|
+
"topBody": {
|
|
689
|
+
"$ref": "#/definitions/border"
|
|
690
|
+
},
|
|
691
|
+
"topJoin": {
|
|
692
|
+
"$ref": "#/definitions/border"
|
|
693
|
+
},
|
|
694
|
+
"topLeft": {
|
|
695
|
+
"$ref": "#/definitions/border"
|
|
696
|
+
},
|
|
697
|
+
"topRight": {
|
|
698
|
+
"$ref": "#/definitions/border"
|
|
699
|
+
},
|
|
700
|
+
"bottomBody": {
|
|
701
|
+
"$ref": "#/definitions/border"
|
|
702
|
+
},
|
|
703
|
+
"bottomJoin": {
|
|
704
|
+
"$ref": "#/definitions/border"
|
|
705
|
+
},
|
|
706
|
+
"bottomLeft": {
|
|
707
|
+
"$ref": "#/definitions/border"
|
|
708
|
+
},
|
|
709
|
+
"bottomRight": {
|
|
710
|
+
"$ref": "#/definitions/border"
|
|
711
|
+
},
|
|
712
|
+
"bodyLeft": {
|
|
713
|
+
"$ref": "#/definitions/border"
|
|
714
|
+
},
|
|
715
|
+
"bodyRight": {
|
|
716
|
+
"$ref": "#/definitions/border"
|
|
717
|
+
},
|
|
718
|
+
"bodyJoin": {
|
|
719
|
+
"$ref": "#/definitions/border"
|
|
720
|
+
},
|
|
721
|
+
"joinBody": {
|
|
722
|
+
"$ref": "#/definitions/border"
|
|
723
|
+
},
|
|
724
|
+
"joinLeft": {
|
|
725
|
+
"$ref": "#/definitions/border"
|
|
726
|
+
},
|
|
727
|
+
"joinRight": {
|
|
728
|
+
"$ref": "#/definitions/border"
|
|
729
|
+
},
|
|
730
|
+
"joinJoin": {
|
|
731
|
+
"$ref": "#/definitions/border"
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
"additionalProperties": false
|
|
735
|
+
},
|
|
736
|
+
"border": {
|
|
737
|
+
"type": "string"
|
|
738
|
+
}
|
|
739
|
+
}
|
|
50
740
|
};
|
|
51
|
-
|
|
52
|
-
module.exports =
|
|
53
|
-
//# sourceMappingURL=validateStreamConfig.js.map
|
|
741
|
+
validate.errors = null;
|
|
742
|
+
module.exports = validate;
|