is-my-json-valid
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -184,3 +184,4 @@ var genobj = require('generate-object-property') | ||
validate('if (!%s.test(%s)) {', n, name) | ||
if (typeof scope[n] === 'function') validate('if (!%s(%s)) {', n, name) | ||
else validate('if (!%s.test(%s)) {', n, name) | ||
error('must be '+node.format+' format') | ||
@@ -187,0 +188,0 @@ validate('}') |
{ | ||
"name": "is-my-json-valid", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "A JSONSchema validator that uses code generation to be extremely fast", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -154,2 +154,21 @@ var tape = require('tape') | ||
tape('custom format function', function(t) { | ||
var validate = validator({ | ||
type: 'object', | ||
properties: { | ||
foo: { | ||
type: 'string', | ||
format: 'as' | ||
} | ||
} | ||
}, {formats: {as:function(s) { return /^a+$/.test(s) } }}) | ||
t.notOk(validate({foo:''}), 'not as') | ||
t.notOk(validate({foo:'b'}), 'not as') | ||
t.notOk(validate({foo:'aaab'}), 'not as') | ||
t.ok(validate({foo:'a'}), 'as') | ||
t.ok(validate({foo:'aaaaaa'}), 'as') | ||
t.end() | ||
}) | ||
var files = fs.readdirSync(__dirname+'/json-schema-draft4') | ||
@@ -156,0 +175,0 @@ .map(function(file) { |
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
92540
2977