diff options
| author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
|---|---|---|
| committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
| commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
| tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/ajv/lib/dot/dependencies.jst | |
| parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) | |
node_modules
Diffstat (limited to 'node_modules/ajv/lib/dot/dependencies.jst')
| -rw-r--r-- | node_modules/ajv/lib/dot/dependencies.jst | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/node_modules/ajv/lib/dot/dependencies.jst b/node_modules/ajv/lib/dot/dependencies.jst index 1198a45fe..c41f33422 100644 --- a/node_modules/ajv/lib/dot/dependencies.jst +++ b/node_modules/ajv/lib/dot/dependencies.jst @@ -5,9 +5,18 @@ {{# def.setupNextLevel }} +{{## def.propertyInData: + {{=$data}}{{= it.util.getProperty($property) }} !== undefined + {{? $ownProperties }} + && Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}') + {{?}} +#}} + + {{ var $schemaDeps = {} - , $propertyDeps = {}; + , $propertyDeps = {} + , $ownProperties = it.opts.ownProperties; for ($property in $schema) { var $sch = $schema[$property]; @@ -23,17 +32,19 @@ var {{=$errs}} = errors; var missing{{=$lvl}}; {{ for (var $property in $propertyDeps) { }} {{ $deps = $propertyDeps[$property]; }} - if ({{=$data}}{{= it.util.getProperty($property) }} !== undefined - {{? $breakOnError }} - && ({{# def.checkMissingProperty:$deps }})) { - {{# def.errorMissingProperty:'dependencies' }} - {{??}} - ) { - {{~ $deps:$reqProperty }} - {{# def.allErrorsMissingProperty:'dependencies' }} - {{~}} - {{?}} - } {{# def.elseIfValid }} + {{? $deps.length }} + if ({{# def.propertyInData }} + {{? $breakOnError }} + && ({{# def.checkMissingProperty:$deps }})) { + {{# def.errorMissingProperty:'dependencies' }} + {{??}} + ) { + {{~ $deps:$propertyKey }} + {{# def.allErrorsMissingProperty:'dependencies' }} + {{~}} + {{?}} + } {{# def.elseIfValid }} + {{?}} {{ } }} {{ @@ -47,7 +58,7 @@ var missing{{=$lvl}}; {{? {{# def.nonEmptySchema:$sch }} }} {{=$nextValid}} = true; - if ({{=$data}}{{= it.util.getProperty($property) }} !== undefined) { + if ({{# def.propertyInData }}) { {{ $it.schema = $sch; $it.schemaPath = $schemaPath + it.util.getProperty($property); |
