summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/har-validator/node_modules/ajv/lib/dot/v5/patternRequired.jst
blob: 9af2cdc9d01eb12f4d2e15c9bf321bf88c0d3037 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{{# def.definitions }}
{{# def.errors }}
{{# def.setupKeyword }}

{{
  var $key = 'key' + $lvl
    , $matched = 'patternMatched' + $lvl
    , $closingBraces = ''
    , $ownProperties = it.opts.ownProperties;
}}

var {{=$valid}} = true;
{{~ $schema:$pProperty }}
  var {{=$matched}} = false;
  for (var {{=$key}} in {{=$data}}) {
    {{# def.checkOwnProperty }}
    {{=$matched}} = {{= it.usePattern($pProperty) }}.test({{=$key}});
    if ({{=$matched}}) break;
  }

  {{ var $missingPattern = it.util.escapeQuotes($pProperty); }}
  if (!{{=$matched}}) {
    {{=$valid}} = false;
    {{# def.addError:'patternRequired' }}
  } {{# def.elseIfValid }}
{{~}}

{{= $closingBraces }}