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

defaults.def 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. {{## def.assignDefault:
  2. {{? it.compositeRule }}
  3. {{
  4. if (it.opts.strictDefaults) {
  5. var $defaultMsg = 'default is ignored for: ' + $passData;
  6. if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
  7. else throw new Error($defaultMsg);
  8. }
  9. }}
  10. {{??}}
  11. if ({{=$passData}} === undefined
  12. {{? it.opts.useDefaults == 'empty' }}
  13. || {{=$passData}} === null
  14. || {{=$passData}} === ''
  15. {{?}}
  16. )
  17. {{=$passData}} = {{? it.opts.useDefaults == 'shared' }}
  18. {{= it.useDefault($sch.default) }}
  19. {{??}}
  20. {{= JSON.stringify($sch.default) }}
  21. {{?}};
  22. {{?}}
  23. #}}
  24. {{## def.defaultProperties:
  25. {{
  26. var $schema = it.schema.properties
  27. , $schemaKeys = Object.keys($schema); }}
  28. {{~ $schemaKeys:$propertyKey }}
  29. {{ var $sch = $schema[$propertyKey]; }}
  30. {{? $sch.default !== undefined }}
  31. {{ var $passData = $data + it.util.getProperty($propertyKey); }}
  32. {{# def.assignDefault }}
  33. {{?}}
  34. {{~}}
  35. #}}
  36. {{## def.defaultItems:
  37. {{~ it.schema.items:$sch:$i }}
  38. {{? $sch.default !== undefined }}
  39. {{ var $passData = $data + '[' + $i + ']'; }}
  40. {{# def.assignDefault }}
  41. {{?}}
  42. {{~}}
  43. #}}