| 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 | |
| 10 | |
| 11 | {{## def.defaultProperties: |
| 12 | {{ |
| 13 | var $schema = it.schema.properties |
| 14 | , $schemaKeys = Object.keys($schema); }} |
| 15 | {{~ $schemaKeys:$propertyKey }} |
| 16 | {{ var $sch = $schema[$propertyKey]; }} |
| 17 | {{? $sch.default !== undefined }} |
| 18 | {{ var $passData = $data + it.util.getProperty($propertyKey); }} |
| 19 | {{# def.assignDefault }} |
| 20 | {{?}} |
| 21 | {{~}} |
| 22 | #}} |
| 23 | |
| 24 | |
| 25 | {{## def.defaultItems: |
| 26 | {{~ it.schema.items:$sch:$i }} |
| 27 | {{? $sch.default !== undefined }} |
| 28 | {{ var $passData = $data + '[' + $i + ']'; }} |
| 29 | {{# def.assignDefault }} |
| 30 | {{?}} |
| 31 | {{~}} |
| 32 | #}} |