Socket
Socket
Sign inDemoInstall

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.3.0 to 2.3.1

2

index.js

@@ -515,3 +515,3 @@ var genobj = require('generate-object-property')

validate.toJSON = function() {
return sch
return schema
}

@@ -518,0 +518,0 @@

{
"name": "is-my-json-valid",
"version": "2.3.0",
"version": "2.3.1",
"description": "A JSONSchema validator that uses code generation to be extremely fast",

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

@@ -75,21 +75,13 @@ # is-my-json-valid

This is module is *fast*
is-my-json-valid uses code generation to turn your JSON schema into basic javascript code that is easily optimizeable by v8.
When running the [cosmicrealms.com benchmark](http://cosmicrealms.com/blog/2014/02/07/benchmark-of-node-dot-js-json-validation-modules-part-2/) it yields
the following results on my macbook air
At the time of writing, is-my-json-valid is the __fastest validator__ when running
```
is-my-json-valid v4 total time (632) and per document time: 0.00316
amanda v3 total time (27121) and per document time: 1.35605
jayschema v4 total time (99449) and per document time: 4.97245
joi v3 total time (11949) and per document time: 0.59745
json-gate v3 total time (1443) and per document time: 0.07215
json-schema v3 total time (1318) and per document time: 0.0659
JSV v3 total time (33495) and per document time: 1.67475
schema v2 total time (1309) and per document time: 0.06545
tv4 v4 total time (703) and per document time: 0.03515
z-schema v4 total time (3188) and per document time: 0.1594
```
* [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark)
* [cosmicreals.com benchmark](http://cosmicrealms.com/blog/2014/08/29/benchmark-of-node-dot-js-json-validation-modules-part-3/)
* [jsck benchmark](https://github.com/pandastrike/jsck/issues/72#issuecomment-70992684)
* [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html)
* [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html)
As seen above `is-my-json-valid` is 2500x faster than the slowest and ~20x faster than the second fastest
If you know any other relevant benchmarks open a PR and I'll add them.

@@ -96,0 +88,0 @@ ## License

@@ -189,1 +189,16 @@ var tape = require('tape')

})
tape('#toJSON()', function(t) {
var schema = {
required: true,
type: 'object',
properties: {
hello: {type:'string', required:true}
}
}
var validate = validator(schema)
t.deepEqual(validate.toJSON(), schema, 'should return original schema')
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