source: trip-planner-front/node_modules/ajv-keywords/keywords/dot/_formatLimit.jst

Last change on this file was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 3.0 KB
Line 
1{{# def.definitions }}
2{{# def.errors }}
3{{# def.setupKeyword }}
4
5var {{=$valid}} = undefined;
6
7{{## def.skipFormatLimit:
8 {{=$valid}} = true;
9 {{ return out; }}
10#}}
11
12{{## def.compareFormat:
13 {{? $isData }}
14 if ({{=$schemaValue}} === undefined) {{=$valid}} = true;
15 else if (typeof {{=$schemaValue}} != 'string') {{=$valid}} = false;
16 else {
17 {{ $closingBraces += '}'; }}
18 {{?}}
19
20 {{? $isDataFormat }}
21 if (!{{=$compare}}) {{=$valid}} = true;
22 else {
23 {{ $closingBraces += '}'; }}
24 {{?}}
25
26 var {{=$result}} = {{=$compare}}({{=$data}}, {{# def.schemaValueQS }});
27
28 if ({{=$result}} === undefined) {{=$valid}} = false;
29#}}
30
31
32{{? it.opts.format === false }}{{# def.skipFormatLimit }}{{?}}
33
34{{
35 var $schemaFormat = it.schema.format
36 , $isDataFormat = it.opts.$data && $schemaFormat.$data
37 , $closingBraces = '';
38}}
39
40{{? $isDataFormat }}
41 {{
42 var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr)
43 , $format = 'format' + $lvl
44 , $compare = 'compare' + $lvl;
45 }}
46
47 var {{=$format}} = formats[{{=$schemaValueFormat}}]
48 , {{=$compare}} = {{=$format}} && {{=$format}}.compare;
49{{??}}
50 {{ var $format = it.formats[$schemaFormat]; }}
51 {{? !($format && $format.compare) }}
52 {{# def.skipFormatLimit }}
53 {{?}}
54 {{ var $compare = 'formats' + it.util.getProperty($schemaFormat) + '.compare'; }}
55{{?}}
56
57{{
58 var $isMax = $keyword == 'formatMaximum'
59 , $exclusiveKeyword = 'formatExclusive' + ($isMax ? 'Maximum' : 'Minimum')
60 , $schemaExcl = it.schema[$exclusiveKeyword]
61 , $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data
62 , $op = $isMax ? '<' : '>'
63 , $result = 'result' + $lvl;
64}}
65
66{{# def.$data }}
67
68
69{{? $isDataExcl }}
70 {{
71 var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
72 , $exclusive = 'exclusive' + $lvl
73 , $opExpr = 'op' + $lvl
74 , $opStr = '\' + ' + $opExpr + ' + \'';
75 }}
76 var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
77 {{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
78
79 if (typeof {{=$schemaValueExcl}} != 'boolean' && {{=$schemaValueExcl}} !== undefined) {
80 {{=$valid}} = false;
81 {{ var $errorKeyword = $exclusiveKeyword; }}
82 {{# def.error:'_formatExclusiveLimit' }}
83 }
84
85 {{# def.elseIfValid }}
86
87 {{# def.compareFormat }}
88 var {{=$exclusive}} = {{=$schemaValueExcl}} === true;
89
90 if ({{=$valid}} === undefined) {
91 {{=$valid}} = {{=$exclusive}}
92 ? {{=$result}} {{=$op}} 0
93 : {{=$result}} {{=$op}}= 0;
94 }
95
96 if (!{{=$valid}}) var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
97{{??}}
98 {{
99 var $exclusive = $schemaExcl === true
100 , $opStr = $op; /*used in error*/
101 if (!$exclusive) $opStr += '=';
102 var $opExpr = '\'' + $opStr + '\''; /*used in error*/
103 }}
104
105 {{# def.compareFormat }}
106
107 if ({{=$valid}} === undefined)
108 {{=$valid}} = {{=$result}} {{=$op}}{{?!$exclusive}}={{?}} 0;
109{{?}}
110
111{{= $closingBraces }}
112
113if (!{{=$valid}}) {
114 {{ var $errorKeyword = $keyword; }}
115 {{# def.error:'_formatLimit' }}
116}
Note: See TracBrowser for help on using the repository browser.