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 1.3.9 to 1.4.0

8

compile.js

@@ -122,4 +122,4 @@ var normalize = require('./normalize')

if (node.minimum !== undefined) {
validate('if (%s < %d) {', name, node.minimum)
error('must be more than '+node.minimum)
validate('if (%s %s %d) {', name, node.exclusiveMinimum ? '<=' : '<', node.minimum)
error('must be more than ' + (node.exclusiveMinimum ? '' : 'or equal to ') +node.minimum)
validate('}')

@@ -129,4 +129,4 @@ }

if (node.maximum !== undefined) {
validate('if (%s > %d) {', name, node.maximum)
error('must be less than '+node.maximum)
validate('if (%s %s %d) {', name, node.exclusiveMaximum ? '>=' : '>', node.maximum)
error('must be less than ' + (node.exclusiveMaximum ? '' : 'or equal to ') +node.maximum)
validate('}')

@@ -133,0 +133,0 @@ }

@@ -40,2 +40,5 @@ var xtend = require('xtend')

if (root.minimum !== undefined) root.exclusiveMinimum = !!node.exclusiveMinimum
if (root.maximum !== undefined) root.exclusiveMaximum = !!node.exclusiveMaximum
if (root.pattern) root.pattern = root.pattern.replace(/(^\/)|(\/$)/g, '')

@@ -74,2 +77,2 @@

return tree
}
}
{
"name": "is-my-json-valid",
"version": "1.3.9",
"version": "1.4.0",
"description": "A JSONSchema / orderly validator that uses code generation to be extremely fast",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -133,1 +133,22 @@ var tape = require('tape')

})
tape('exclusiveMinimum/exclusiveMaximum', function(t) {
var validate = validator({
type: 'object',
properties: {
foo: {
type: 'number',
minimum: 10,
maximum: 20,
exclusiveMinimum: true,
exclusiveMaximum: true
}
}
})
t.notOk(validate({foo:10}))
t.ok(validate({foo:11}))
t.notOk(validate({foo:20}))
t.ok(validate({foo:19}))
t.end()
})
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