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

propertyNames.jst 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {{# def.definitions }}
  2. {{# def.errors }}
  3. {{# def.setupKeyword }}
  4. {{# def.setupNextLevel }}
  5. var {{=$errs}} = errors;
  6. {{? {{# def.nonEmptySchema:$schema }} }}
  7. {{
  8. $it.schema = $schema;
  9. $it.schemaPath = $schemaPath;
  10. $it.errSchemaPath = $errSchemaPath;
  11. }}
  12. {{
  13. var $key = 'key' + $lvl
  14. , $idx = 'idx' + $lvl
  15. , $i = 'i' + $lvl
  16. , $invalidName = '\' + ' + $key + ' + \''
  17. , $dataNxt = $it.dataLevel = it.dataLevel + 1
  18. , $nextData = 'data' + $dataNxt
  19. , $dataProperties = 'dataProperties' + $lvl
  20. , $ownProperties = it.opts.ownProperties
  21. , $currentBaseId = it.baseId;
  22. }}
  23. {{? $ownProperties }}
  24. var {{=$dataProperties}} = undefined;
  25. {{?}}
  26. {{# def.iterateProperties }}
  27. var startErrs{{=$lvl}} = errors;
  28. {{ var $passData = $key; }}
  29. {{# def.setCompositeRule }}
  30. {{# def.generateSubschemaCode }}
  31. {{# def.optimizeValidate }}
  32. {{# def.resetCompositeRule }}
  33. if (!{{=$nextValid}}) {
  34. for (var {{=$i}}=startErrs{{=$lvl}}; {{=$i}}<errors; {{=$i}}++) {
  35. vErrors[{{=$i}}].propertyName = {{=$key}};
  36. }
  37. {{# def.extraError:'propertyNames' }}
  38. {{? $breakOnError }} break; {{?}}
  39. }
  40. }
  41. {{?}}
  42. {{? $breakOnError }}
  43. {{= $closingBraces }}
  44. if ({{=$errs}} == errors) {
  45. {{?}}