enum.jst 552 B

12345678910111213141516171819202122232425262728293031
  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 { {{?}}