defaults.def 859 B

1234567891011121314151617181920212223242526272829303132
  1. {{## def.assignDefault:
  2. if ({{=$passData}} === undefined)
  3. {{=$passData}} = {{? it.opts.useDefaults == 'shared' }}
  4. {{= it.useDefault($sch.default) }}
  5. {{??}}
  6. {{= JSON.stringify($sch.default) }}
  7. {{?}};
  8. #}}
  9. {{## def.defaultProperties:
  10. {{
  11. var $schema = it.schema.properties
  12. , $schemaKeys = Object.keys($schema); }}
  13. {{~ $schemaKeys:$propertyKey }}
  14. {{ var $sch = $schema[$propertyKey]; }}
  15. {{? $sch.default !== undefined }}
  16. {{ var $passData = $data + it.util.getProperty($propertyKey); }}
  17. {{# def.assignDefault }}
  18. {{?}}
  19. {{~}}
  20. #}}
  21. {{## def.defaultItems:
  22. {{~ it.schema.items:$sch:$i }}
  23. {{? $sch.default !== undefined }}
  24. {{ var $passData = $data + '[' + $i + ']'; }}
  25. {{# def.assignDefault }}
  26. {{?}}
  27. {{~}}
  28. #}}