Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

contains.jst 1.2KB

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