maximum/minimum keywords optimized
parent
106826146e
commit
5582e13c1d
|
@ -3,9 +3,10 @@
|
|||
|
||||
{{
|
||||
var $exclusive = it.schema.exclusiveMaximum === true
|
||||
, $op = $exclusive ? '<' : '<=';
|
||||
, $op = $exclusive ? '<' : '<=' /*used in error*/
|
||||
, $notOp = $exclusive ? '>=' : '>';
|
||||
}}
|
||||
|
||||
if (! ({{=$data}} {{=$op}} {{=$schema}}) ) {
|
||||
if ({{=$data}} {{=$notOp}} {{=$schema}}) {
|
||||
{{# def.error:'maximum' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.setup:'minItems' }}
|
||||
|
||||
if ({{=$data}}.length < {{=$schema}}) {
|
||||
if ({{=$data}}.length < {{=$schema}}) {
|
||||
{{# def.error:'minItems' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
{{
|
||||
var $exclusive = it.schema.exclusiveMinimum === true
|
||||
, $op = $exclusive ? '>' : '>=';
|
||||
, $op = $exclusive ? '>' : '>=' /*used in error*/
|
||||
, $notOp = $exclusive ? '<=' : '<';
|
||||
}}
|
||||
|
||||
if (!( {{=$data}} {{=$op}} {{=$schema}} )) {
|
||||
if ({{=$data}} {{=$notOp}} {{=$schema}}) {
|
||||
{{# def.error:'minimum' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ajv",
|
||||
"version": "0.4.6",
|
||||
"version": "0.4.7",
|
||||
"description": "Another JSON schema Validator",
|
||||
"main": "lib/ajv.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in New Issue