twitst4tz

twitter statistics web application
Log | Files | Refs | README | LICENSE

contains.jst (1208B)


      1 {{# def.definitions }}
      2 {{# def.errors }}
      3 {{# def.setupKeyword }}
      4 {{# def.setupNextLevel }}
      5 
      6 
      7 {{
      8   var $idx = 'i' + $lvl
      9     , $dataNxt = $it.dataLevel = it.dataLevel + 1
     10     , $nextData = 'data' + $dataNxt
     11     , $currentBaseId = it.baseId
     12     , $nonEmptySchema = {{# def.nonEmptySchema:$schema }};
     13 }}
     14 
     15 var {{=$errs}} = errors;
     16 var {{=$valid}};
     17 
     18 {{? $nonEmptySchema }}
     19   {{# def.setCompositeRule }}
     20 
     21   {{
     22     $it.schema = $schema;
     23     $it.schemaPath = $schemaPath;
     24     $it.errSchemaPath = $errSchemaPath;
     25   }}
     26 
     27   var {{=$nextValid}} = false;
     28 
     29   for (var {{=$idx}} = 0; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
     30     {{
     31       $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
     32       var $passData = $data + '[' + $idx + ']';
     33       $it.dataPathArr[$dataNxt] = $idx;
     34     }}
     35 
     36     {{# def.generateSubschemaCode }}
     37     {{# def.optimizeValidate }}
     38 
     39     if ({{=$nextValid}}) break;
     40   }
     41 
     42   {{# def.resetCompositeRule }}
     43   {{= $closingBraces }}
     44 
     45   if (!{{=$nextValid}}) {
     46 {{??}}
     47   if ({{=$data}}.length == 0) {
     48 {{?}}
     49 
     50     {{# def.error:'contains' }}
     51   } else {
     52     {{? $nonEmptySchema }}
     53       {{# def.resetErrors }}
     54     {{?}}
     55   {{? it.opts.allErrors }} } {{?}}
     56 
     57 {{# def.cleanUp }}