You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
552 B

4 years ago
  1. {{# def.definitions }}
  2. {{# def.errors }}
  3. {{# def.setupKeyword }}
  4. {{# def.$data }}
  5. {{
  6. var $i = 'i' + $lvl
  7. , $vSchema = 'schema' + $lvl;
  8. }}
  9. {{? !$isData }}
  10. var {{=$vSchema}} = validate.schema{{=$schemaPath}};
  11. {{?}}
  12. var {{=$valid}};
  13. {{?$isData}}{{# def.check$dataIsArray }}{{?}}
  14. {{=$valid}} = false;
  15. for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++)
  16. if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) {
  17. {{=$valid}} = true;
  18. break;
  19. }
  20. {{? $isData }} } {{?}}
  21. {{# def.checkError:'enum' }}
  22. {{? $breakOnError }} else { {{?}}