Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-my-json-valid

Package Overview
Dependencies
Maintainers
2
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-my-json-valid - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

3

index.js

@@ -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) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc