diff options
Diffstat (limited to 'deps/npm/node_modules/ajv/lib/dot/defaults.def')
-rw-r--r-- | deps/npm/node_modules/ajv/lib/dot/defaults.def | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/deps/npm/node_modules/ajv/lib/dot/defaults.def b/deps/npm/node_modules/ajv/lib/dot/defaults.def new file mode 100644 index 0000000000..5ad8d1d2d2 --- /dev/null +++ b/deps/npm/node_modules/ajv/lib/dot/defaults.def @@ -0,0 +1,32 @@ +{{## def.assignDefault: + if ({{=$passData}} === undefined) + {{=$passData}} = {{? it.opts.useDefaults == 'shared' }} + {{= it.useDefault($sch.default) }} + {{??}} + {{= JSON.stringify($sch.default) }} + {{?}}; +#}} + + +{{## def.defaultProperties: + {{ + var $schema = it.schema.properties + , $schemaKeys = Object.keys($schema); }} + {{~ $schemaKeys:$propertyKey }} + {{ var $sch = $schema[$propertyKey]; }} + {{? $sch.default !== undefined }} + {{ var $passData = $data + it.util.getProperty($propertyKey); }} + {{# def.assignDefault }} + {{?}} + {{~}} +#}} + + +{{## def.defaultItems: + {{~ it.schema.items:$sch:$i }} + {{? $sch.default !== undefined }} + {{ var $passData = $data + '[' + $i + ']'; }} + {{# def.assignDefault }} + {{?}} + {{~}} +#}} |