• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2var equal = require('ajv/lib/compile/equal');
3var 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.hasOwnProperty(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 (typeof data !== "string") {
247        var err = {
248          keyword: 'type',
249          dataPath: (dataPath || '') + "",
250          schemaPath: '#/type',
251          params: {
252            type: 'string'
253          },
254          message: 'should be string'
255        };
256        if (vErrors === null) vErrors = [err];
257        else vErrors.push(err);
258        errors++;
259      }
260      validate.errors = vErrors;
261      return errors === 0;
262    };
263  })();
264  refVal2.schema = {
265    "type": "string"
266  };
267  refVal2.errors = null;
268  refVal[2] = refVal2;
269  var refVal3 = (function() {
270    var pattern0 = new RegExp('^[0-9]+$');
271    return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
272      'use strict';
273      var vErrors = null;
274      var errors = 0;
275      if (rootData === undefined) rootData = data;
276      if ((data && typeof data === "object" && !Array.isArray(data))) {
277        var errs__0 = errors;
278        var valid1 = true;
279        for (var key0 in data) {
280          var isAdditional0 = !(false || pattern0.test(key0));
281          if (isAdditional0) {
282            valid1 = false;
283            var err = {
284              keyword: 'additionalProperties',
285              dataPath: (dataPath || '') + "",
286              schemaPath: '#/additionalProperties',
287              params: {
288                additionalProperty: '' + key0 + ''
289              },
290              message: 'should NOT have additional properties'
291            };
292            if (vErrors === null) vErrors = [err];
293            else vErrors.push(err);
294            errors++;
295          }
296        }
297        for (var key0 in data) {
298          if (pattern0.test(key0)) {
299            var errs_1 = errors;
300            if (!refVal4(data[key0], (dataPath || '') + '[\'' + key0 + '\']', data, key0, rootData)) {
301              if (vErrors === null) vErrors = refVal4.errors;
302              else vErrors = vErrors.concat(refVal4.errors);
303              errors = vErrors.length;
304            }
305            var valid1 = errors === errs_1;
306          }
307        }
308      } else {
309        var err = {
310          keyword: 'type',
311          dataPath: (dataPath || '') + "",
312          schemaPath: '#/type',
313          params: {
314            type: 'object'
315          },
316          message: 'should be object'
317        };
318        if (vErrors === null) vErrors = [err];
319        else vErrors.push(err);
320        errors++;
321      }
322      validate.errors = vErrors;
323      return errors === 0;
324    };
325  })();
326  refVal3.schema = {
327    "type": "object",
328    "patternProperties": {
329      "^[0-9]+$": {
330        "$ref": "#/definitions/column"
331      }
332    },
333    "additionalProperties": false
334  };
335  refVal3.errors = null;
336  refVal[3] = refVal3;
337  var refVal4 = (function() {
338    var pattern0 = new RegExp('^[0-9]+$');
339    return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
340      'use strict';
341      var vErrors = null;
342      var errors = 0;
343      if ((data && typeof data === "object" && !Array.isArray(data))) {
344        var errs__0 = errors;
345        var valid1 = true;
346        for (var key0 in data) {
347          var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight');
348          if (isAdditional0) {
349            valid1 = false;
350            var err = {
351              keyword: 'additionalProperties',
352              dataPath: (dataPath || '') + "",
353              schemaPath: '#/additionalProperties',
354              params: {
355                additionalProperty: '' + key0 + ''
356              },
357              message: 'should NOT have additional properties'
358            };
359            if (vErrors === null) vErrors = [err];
360            else vErrors.push(err);
361            errors++;
362          }
363        }
364        var data1 = data.alignment;
365        if (data1 !== undefined) {
366          var errs_1 = errors;
367          if (typeof data1 !== "string") {
368            var err = {
369              keyword: 'type',
370              dataPath: (dataPath || '') + '.alignment',
371              schemaPath: '#/properties/alignment/type',
372              params: {
373                type: 'string'
374              },
375              message: 'should be string'
376            };
377            if (vErrors === null) vErrors = [err];
378            else vErrors.push(err);
379            errors++;
380          }
381          var schema1 = validate.schema.properties.alignment.enum;
382          var valid1;
383          valid1 = false;
384          for (var i1 = 0; i1 < schema1.length; i1++)
385            if (equal(data1, schema1[i1])) {
386              valid1 = true;
387              break;
388            } if (!valid1) {
389            var err = {
390              keyword: 'enum',
391              dataPath: (dataPath || '') + '.alignment',
392              schemaPath: '#/properties/alignment/enum',
393              params: {
394                allowedValues: schema1
395              },
396              message: 'should be equal to one of the allowed values'
397            };
398            if (vErrors === null) vErrors = [err];
399            else vErrors.push(err);
400            errors++;
401          }
402          var valid1 = errors === errs_1;
403        }
404        if (data.width !== undefined) {
405          var errs_1 = errors;
406          if (typeof data.width !== "number") {
407            var err = {
408              keyword: 'type',
409              dataPath: (dataPath || '') + '.width',
410              schemaPath: '#/properties/width/type',
411              params: {
412                type: 'number'
413              },
414              message: 'should be number'
415            };
416            if (vErrors === null) vErrors = [err];
417            else vErrors.push(err);
418            errors++;
419          }
420          var valid1 = errors === errs_1;
421        }
422        if (data.wrapWord !== undefined) {
423          var errs_1 = errors;
424          if (typeof data.wrapWord !== "boolean") {
425            var err = {
426              keyword: 'type',
427              dataPath: (dataPath || '') + '.wrapWord',
428              schemaPath: '#/properties/wrapWord/type',
429              params: {
430                type: 'boolean'
431              },
432              message: 'should be boolean'
433            };
434            if (vErrors === null) vErrors = [err];
435            else vErrors.push(err);
436            errors++;
437          }
438          var valid1 = errors === errs_1;
439        }
440        if (data.truncate !== undefined) {
441          var errs_1 = errors;
442          if (typeof data.truncate !== "number") {
443            var err = {
444              keyword: 'type',
445              dataPath: (dataPath || '') + '.truncate',
446              schemaPath: '#/properties/truncate/type',
447              params: {
448                type: 'number'
449              },
450              message: 'should be number'
451            };
452            if (vErrors === null) vErrors = [err];
453            else vErrors.push(err);
454            errors++;
455          }
456          var valid1 = errors === errs_1;
457        }
458        if (data.paddingLeft !== undefined) {
459          var errs_1 = errors;
460          if (typeof data.paddingLeft !== "number") {
461            var err = {
462              keyword: 'type',
463              dataPath: (dataPath || '') + '.paddingLeft',
464              schemaPath: '#/properties/paddingLeft/type',
465              params: {
466                type: 'number'
467              },
468              message: 'should be number'
469            };
470            if (vErrors === null) vErrors = [err];
471            else vErrors.push(err);
472            errors++;
473          }
474          var valid1 = errors === errs_1;
475        }
476        if (data.paddingRight !== undefined) {
477          var errs_1 = errors;
478          if (typeof data.paddingRight !== "number") {
479            var err = {
480              keyword: 'type',
481              dataPath: (dataPath || '') + '.paddingRight',
482              schemaPath: '#/properties/paddingRight/type',
483              params: {
484                type: 'number'
485              },
486              message: 'should be number'
487            };
488            if (vErrors === null) vErrors = [err];
489            else vErrors.push(err);
490            errors++;
491          }
492          var valid1 = errors === errs_1;
493        }
494      } else {
495        var err = {
496          keyword: 'type',
497          dataPath: (dataPath || '') + "",
498          schemaPath: '#/type',
499          params: {
500            type: 'object'
501          },
502          message: 'should be object'
503        };
504        if (vErrors === null) vErrors = [err];
505        else vErrors.push(err);
506        errors++;
507      }
508      validate.errors = vErrors;
509      return errors === 0;
510    };
511  })();
512  refVal4.schema = {
513    "type": "object",
514    "properties": {
515      "alignment": {
516        "type": "string",
517        "enum": ["left", "right", "center"]
518      },
519      "width": {
520        "type": "number"
521      },
522      "wrapWord": {
523        "type": "boolean"
524      },
525      "truncate": {
526        "type": "number"
527      },
528      "paddingLeft": {
529        "type": "number"
530      },
531      "paddingRight": {
532        "type": "number"
533      }
534    },
535    "additionalProperties": false
536  };
537  refVal4.errors = null;
538  refVal[4] = refVal4;
539  return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
540    'use strict'; /*# sourceURL=config.json */
541    var vErrors = null;
542    var errors = 0;
543    if (rootData === undefined) rootData = data;
544    if ((data && typeof data === "object" && !Array.isArray(data))) {
545      var errs__0 = errors;
546      var valid1 = true;
547      for (var key0 in data) {
548        var isAdditional0 = !(false || key0 == 'border' || key0 == 'columns' || key0 == 'columnDefault' || key0 == 'drawHorizontalLine');
549        if (isAdditional0) {
550          valid1 = false;
551          var err = {
552            keyword: 'additionalProperties',
553            dataPath: (dataPath || '') + "",
554            schemaPath: '#/additionalProperties',
555            params: {
556              additionalProperty: '' + key0 + ''
557            },
558            message: 'should NOT have additional properties'
559          };
560          if (vErrors === null) vErrors = [err];
561          else vErrors.push(err);
562          errors++;
563        }
564      }
565      if (data.border !== undefined) {
566        var errs_1 = errors;
567        if (!refVal1(data.border, (dataPath || '') + '.border', data, 'border', rootData)) {
568          if (vErrors === null) vErrors = refVal1.errors;
569          else vErrors = vErrors.concat(refVal1.errors);
570          errors = vErrors.length;
571        }
572        var valid1 = errors === errs_1;
573      }
574      if (data.columns !== undefined) {
575        var errs_1 = errors;
576        if (!refVal3(data.columns, (dataPath || '') + '.columns', data, 'columns', rootData)) {
577          if (vErrors === null) vErrors = refVal3.errors;
578          else vErrors = vErrors.concat(refVal3.errors);
579          errors = vErrors.length;
580        }
581        var valid1 = errors === errs_1;
582      }
583      if (data.columnDefault !== undefined) {
584        var errs_1 = errors;
585        if (!refVal[4](data.columnDefault, (dataPath || '') + '.columnDefault', data, 'columnDefault', rootData)) {
586          if (vErrors === null) vErrors = refVal[4].errors;
587          else vErrors = vErrors.concat(refVal[4].errors);
588          errors = vErrors.length;
589        }
590        var valid1 = errors === errs_1;
591      }
592      if (data.drawHorizontalLine !== undefined) {
593        var errs_1 = errors;
594        var errs__1 = errors;
595        var valid1;
596        valid1 = typeof data.drawHorizontalLine == "function";
597        if (!valid1) {
598          if (errs__1 == errors) {
599            var err = {
600              keyword: 'typeof',
601              dataPath: (dataPath || '') + '.drawHorizontalLine',
602              schemaPath: '#/properties/drawHorizontalLine/typeof',
603              params: {
604                keyword: 'typeof'
605              },
606              message: 'should pass "typeof" keyword validation'
607            };
608            if (vErrors === null) vErrors = [err];
609            else vErrors.push(err);
610            errors++;
611          } else {
612            for (var i1 = errs__1; i1 < errors; i1++) {
613              var ruleErr1 = vErrors[i1];
614              if (ruleErr1.dataPath === undefined) ruleErr1.dataPath = (dataPath || '') + '.drawHorizontalLine';
615              if (ruleErr1.schemaPath === undefined) {
616                ruleErr1.schemaPath = "#/properties/drawHorizontalLine/typeof";
617              }
618            }
619          }
620        }
621        var valid1 = errors === errs_1;
622      }
623    } else {
624      var err = {
625        keyword: 'type',
626        dataPath: (dataPath || '') + "",
627        schemaPath: '#/type',
628        params: {
629          type: 'object'
630        },
631        message: 'should be object'
632      };
633      if (vErrors === null) vErrors = [err];
634      else vErrors.push(err);
635      errors++;
636    }
637    validate.errors = vErrors;
638    return errors === 0;
639  };
640})();
641validate.schema = {
642  "$id": "config.json",
643  "$schema": "http://json-schema.org/draft-07/schema#",
644  "type": "object",
645  "properties": {
646    "border": {
647      "$ref": "#/definitions/borders"
648    },
649    "columns": {
650      "$ref": "#/definitions/columns"
651    },
652    "columnDefault": {
653      "$ref": "#/definitions/column"
654    },
655    "drawHorizontalLine": {
656      "typeof": "function"
657    }
658  },
659  "additionalProperties": false,
660  "definitions": {
661    "columns": {
662      "type": "object",
663      "patternProperties": {
664        "^[0-9]+$": {
665          "$ref": "#/definitions/column"
666        }
667      },
668      "additionalProperties": false
669    },
670    "column": {
671      "type": "object",
672      "properties": {
673        "alignment": {
674          "type": "string",
675          "enum": ["left", "right", "center"]
676        },
677        "width": {
678          "type": "number"
679        },
680        "wrapWord": {
681          "type": "boolean"
682        },
683        "truncate": {
684          "type": "number"
685        },
686        "paddingLeft": {
687          "type": "number"
688        },
689        "paddingRight": {
690          "type": "number"
691        }
692      },
693      "additionalProperties": false
694    },
695    "borders": {
696      "type": "object",
697      "properties": {
698        "topBody": {
699          "$ref": "#/definitions/border"
700        },
701        "topJoin": {
702          "$ref": "#/definitions/border"
703        },
704        "topLeft": {
705          "$ref": "#/definitions/border"
706        },
707        "topRight": {
708          "$ref": "#/definitions/border"
709        },
710        "bottomBody": {
711          "$ref": "#/definitions/border"
712        },
713        "bottomJoin": {
714          "$ref": "#/definitions/border"
715        },
716        "bottomLeft": {
717          "$ref": "#/definitions/border"
718        },
719        "bottomRight": {
720          "$ref": "#/definitions/border"
721        },
722        "bodyLeft": {
723          "$ref": "#/definitions/border"
724        },
725        "bodyRight": {
726          "$ref": "#/definitions/border"
727        },
728        "bodyJoin": {
729          "$ref": "#/definitions/border"
730        },
731        "joinBody": {
732          "$ref": "#/definitions/border"
733        },
734        "joinLeft": {
735          "$ref": "#/definitions/border"
736        },
737        "joinRight": {
738          "$ref": "#/definitions/border"
739        },
740        "joinJoin": {
741          "$ref": "#/definitions/border"
742        }
743      },
744      "additionalProperties": false
745    },
746    "border": {
747      "type": "string"
748    }
749  }
750};
751validate.errors = null;
752module.exports = validate;