Comparing version 6.12.3 to 6.12.4
@@ -156,8 +156,7 @@ 'use strict'; | ||
$coerced = 'coerced' + $lvl; | ||
out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; '; | ||
out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; '; | ||
if (it.opts.coerceTypes == 'array') { | ||
out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; '; | ||
out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } '; | ||
} | ||
out += ' var ' + ($coerced) + ' = undefined; '; | ||
var $bracesCoercion = ''; | ||
out += ' if (' + ($coerced) + ' !== undefined) ; '; | ||
var arr1 = $coerceToTypes; | ||
@@ -169,13 +168,6 @@ if (arr1) { | ||
$type = arr1[$i += 1]; | ||
if ($i) { | ||
out += ' if (' + ($coerced) + ' === undefined) { '; | ||
$bracesCoercion += '}'; | ||
} | ||
if (it.opts.coerceTypes == 'array' && $type != 'array') { | ||
out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } '; | ||
} | ||
if ($type == 'string') { | ||
out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; | ||
out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; | ||
} else if ($type == 'number' || $type == 'integer') { | ||
out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; | ||
out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; | ||
if ($type == 'integer') { | ||
@@ -186,11 +178,11 @@ out += ' && !(' + ($data) + ' % 1)'; | ||
} else if ($type == 'boolean') { | ||
out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; | ||
out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; | ||
} else if ($type == 'null') { | ||
out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; | ||
out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; | ||
} else if (it.opts.coerceTypes == 'array' && $type == 'array') { | ||
out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; | ||
out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; | ||
} | ||
} | ||
} | ||
out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { '; | ||
out += ' else { '; | ||
var $$outStack = $$outStack || []; | ||
@@ -235,3 +227,3 @@ $$outStack.push(out); | ||
} | ||
out += ' } else { '; | ||
out += ' } if (' + ($coerced) + ' !== undefined) { '; | ||
var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', | ||
@@ -238,0 +230,0 @@ $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; |
{ | ||
"name": "ajv", | ||
"version": "6.12.3", | ||
"version": "6.12.4", | ||
"description": "Another JSON Schema Validator", | ||
@@ -5,0 +5,0 @@ "main": "lib/ajv.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
922968
13158
1478