Comparing version 0.6.6 to 0.6.7
@@ -10,2 +10,3 @@ 'use strict'; | ||
getProperty: getProperty, | ||
escapeQuotes: escapeQuotes, | ||
escapeRegExp: escapeRegExp, | ||
@@ -85,9 +86,15 @@ ucs2length: ucs2length, | ||
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; | ||
var SINGLE_QUOTE = /('|\\)/g; | ||
function getProperty(key) { | ||
return IDENTIFIER.test(key) | ||
? '.' + key | ||
: "['" + key.replace(/'/g, "\\'") + "']"; | ||
: "['" + key.replace(SINGLE_QUOTE, "\\$1") + "']"; | ||
} | ||
function escapeQuotes(str) { | ||
return str.replace(SINGLE_QUOTE, "\\$1"); | ||
} | ||
var ESCAPE_REGEXP = /[\/]/g | ||
@@ -94,0 +101,0 @@ function escapeRegExp(str) { |
@@ -30,3 +30,3 @@ 'use strict'; | ||
var $prop = it.util.getProperty($property); | ||
out += ' ( ' + ($data) + ($prop) + ' === undefined && (missing' + ($lvl) + ' = \'' + ($prop) + '\') ) '; | ||
out += ' ( ' + ($data) + ($prop) + ' === undefined && (missing' + ($lvl) + ' = \'' + (it.util.escapeQuotes($prop)) + '\') ) '; | ||
} | ||
@@ -83,4 +83,4 @@ } | ||
var $prop = it.util.getProperty($property), | ||
$missingProperty = $prop; | ||
it.errorPath = ($currentErrorPath + ' + "' + $prop + '"').replace('" + "', ''); | ||
$missingProperty = it.util.escapeQuotes($prop); | ||
it.errorPath = ($currentErrorPath + ' + \'' + $missingProperty + '\'').replace('" + "', ''); | ||
out += ' if (' + ($data) + ($prop) + ' === undefined) { '; | ||
@@ -87,0 +87,0 @@ if (it.wasTop && $breakOnError) { |
{ | ||
"name": "ajv", | ||
"version": "0.6.6", | ||
"version": "0.6.7", | ||
"description": "Another JSON Schema Validator", | ||
@@ -5,0 +5,0 @@ "main": "lib/ajv.js", |
@@ -197,2 +197,3 @@ # ajv - Another JSON Schema Validator | ||
``` | ||
npm install | ||
git submodule update --init | ||
@@ -211,3 +212,3 @@ npm test | ||
`bin/git-hook` to install symbolic link to pre-commit hook that will compile templates and run tests when you commit. | ||
`bin/git-hook` to install symbolic link to pre-commit hook that will compile templates and run tests. | ||
@@ -214,0 +215,0 @@ |
@@ -66,3 +66,3 @@ [ | ||
{ | ||
"description": "valid", | ||
"description": "invalid", | ||
"data": [ | ||
@@ -69,0 +69,0 @@ { |
Sorry, the diff of this file is not supported yet
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
370171
162
9869
254