replace hasOwnProperty with !== undefined
parent
f47d821418
commit
1a6e9c8d63
|
@ -95,7 +95,7 @@ var {{=$valid}} = true;
|
|||
}}
|
||||
|
||||
{{? $breakOnError }} {{=$valid}} = true; {{?}}
|
||||
if ({{=$data}}.hasOwnProperty('{{= $propertyKey }}')) {
|
||||
if ({{=$data}}['{{= $propertyKey }}'] !== undefined) {
|
||||
{{ /* TODO cache data types and paths by keys for patternProperties */ }}
|
||||
{{ var $useKey = '"' + $propertyKey + '"'; }}
|
||||
{{# def.validateProperty:$useKey }}
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
{{? $schema.length <= 100 }}
|
||||
{{=$valid}} = {{~ $schema:$property:$i }}
|
||||
{{? $i}} && {{?}}
|
||||
{{=$data}}.hasOwnProperty('{{= it.escapeQuotes($property) }}')
|
||||
{{=$data}}['{{= it.escapeQuotes($property) }}'] !== undefined
|
||||
{{~}};
|
||||
{{??}}
|
||||
var schema{{=$lvl}} = validate.schema{{=$schemaPath}};
|
||||
|
||||
for (var i{{=$lvl}} = 0; i{{=$lvl}} < schema{{=$lvl}}.length; i{{=$lvl}}++) {
|
||||
{{=$valid}} = data.hasOwnProperty(schema{{=$lvl}}[i{{=$lvl}}]);
|
||||
{{=$valid}} = data[schema{{=$lvl}}[i{{=$lvl}}]] !== undefined;
|
||||
if (!{{=$valid}}) break;
|
||||
}
|
||||
{{?}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ajv",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"description": "Another JSON schema Validator",
|
||||
"main": "lib/ajv.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in New Issue