main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
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 |
|
---|
25 |
|
---|
26 | {{## def.defaultProperties:
|
---|
27 | {{
|
---|
28 | var $schema = it.schema.properties
|
---|
29 | , $schemaKeys = Object.keys($schema); }}
|
---|
30 | {{~ $schemaKeys:$propertyKey }}
|
---|
31 | {{ var $sch = $schema[$propertyKey]; }}
|
---|
32 | {{? $sch.default !== undefined }}
|
---|
33 | {{ var $passData = $data + it.util.getProperty($propertyKey); }}
|
---|
34 | {{# def.assignDefault }}
|
---|
35 | {{?}}
|
---|
36 | {{~}}
|
---|
37 | #}}
|
---|
38 |
|
---|
39 |
|
---|
40 | {{## def.defaultItems:
|
---|
41 | {{~ it.schema.items:$sch:$i }}
|
---|
42 | {{? $sch.default !== undefined }}
|
---|
43 | {{ var $passData = $data + '[' + $i + ']'; }}
|
---|
44 | {{# def.assignDefault }}
|
---|
45 | {{?}}
|
---|
46 | {{~}}
|
---|
47 | #}}
|
---|
Note:
See
TracBrowser
for help on using the repository browser.