is-my-json-valid
Advanced tools
Comparing version 2.20.1 to 2.20.2
11
index.js
@@ -113,5 +113,10 @@ var genobj = require('generate-object-property') | ||
var testLimitedRegex = function (r, s, maxLength) { | ||
if (maxLength > -1 && s.length > maxLength) return true | ||
return r.test(s) | ||
} | ||
var compile = function(schema, cache, root, reporter, opts) { | ||
var fmts = opts ? xtend(formats, opts.formats) : formats | ||
var scope = {unique:unique, formats:fmts, isMultipleOf:isMultipleOf} | ||
var scope = {unique:unique, formats:fmts, isMultipleOf:isMultipleOf, testLimitedRegex:testLimitedRegex} | ||
var verbose = opts ? !!opts.verbose : false; | ||
@@ -222,3 +227,3 @@ var greedy = opts && opts.greedy !== undefined ? | ||
if (typeof scope[n] === 'function') validate('if (!%s(%s)) {', n, name) | ||
else validate('if (!%s.test(%s)) {', n, name) | ||
else validate('if (!testLimitedRegex(%s, %s, %d)) {', n, name, typeof node.maxLength === 'undefined' ? -1 : node.maxLength) | ||
error('must be '+node.format+' format') | ||
@@ -397,3 +402,3 @@ validate('}') | ||
if (type !== 'string') validate('if (%s) {', types.string(name)) | ||
validate('if (!(%s.test(%s))) {', p, name) | ||
validate('if (!(testLimitedRegex(%s, %s, %d))) {', p, name, typeof node.maxLength === 'undefined' ? -1 : node.maxLength) | ||
error('pattern mismatch') | ||
@@ -400,0 +405,0 @@ validate('}') |
{ | ||
"name": "is-my-json-valid", | ||
"version": "2.20.1", | ||
"version": "2.20.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": "mafintosh/is-my-json-valid", |
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
39864
663