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

z-schema

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

z-schema - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

10

package.json

@@ -22,2 +22,6 @@ {

"url": "https://github.com/oleksiyk"
},
{
"name": "Jurie-Jan Botha",
"url": "https://github.com/juriejan"
}

@@ -31,3 +35,3 @@ ],

"files": ["src/ZSchema.js", "src/ZSchema.min.js", "LICENSE", "README.md"],
"version": "2.0.0",
"version": "2.0.1",
"dependencies": {

@@ -37,3 +41,3 @@ "q": "0.9.7"

"devDependencies": {
"chai": "1.7.2",
"chai": "1.8.1",
"grunt": "0.4.1",

@@ -43,3 +47,3 @@ "grunt-contrib-uglify": "0.2.4",

"grunt-simple-mocha": "0.4.0",
"mocha": "1.12.1",
"mocha": "1.13.0",
"uglify-js": "2.4.0"

@@ -46,0 +50,0 @@ },

# z-schema validator
[![NPM version](https://badge.fury.io/js/z-schema.png)](http://badge.fury.io/js/z-schema)
[![Dependency Status](https://gemnasium.com/zaggino/z-schema.png)](https://gemnasium.com/zaggino/z-schema)

@@ -23,3 +24,7 @@ JSON Schema validator for Node.js (draft4 version)

```javascript
zSchema.validate(json, schema)
var ZSchema = require("z-schema");
```
```javascript
ZSchema.validate(json, schema)
.then(function(report){

@@ -36,3 +41,3 @@ // successful validation

```javascript
zSchema.validate(json, schema, function(err, report){
ZSchema.validate(json, schema, function(err, report){
if(err){

@@ -50,3 +55,3 @@ console.error(err.errors);

```javascript
var validator = new zSchema();
var validator = new ZSchema();
validator.validateSchema(schema)

@@ -62,3 +67,3 @@ .then(function(report){

```javascript
var validator = new zSchema();
var validator = new ZSchema();
validator.validateSchema(schema, function (err, report) {

@@ -80,3 +85,3 @@ if (err) ...

var fileContent = fs.readFileSync(__dirname + '/../json_schema_test_suite/remotes/integer.json', 'utf8');
zSchema.setRemoteReference('http://localhost:1234/integer.json', fileContent);
ZSchema.setRemoteReference('http://localhost:1234/integer.json', fileContent);
```

@@ -95,3 +100,3 @@

```javascript
var validator = new zSchema();
var validator = new ZSchema();
validator.compileSchema(schema)

@@ -105,3 +110,3 @@ .then(function(compiledSchema){

```javascript
var validator = new zSchema();
var validator = new ZSchema();
validator.compileSchema(schema, function (err, compiledSchema) {

@@ -116,3 +121,4 @@ assert.isUndefined(err);

```javascript
zSchema.validate(json, compiledSchema)
var validator = new ZSchema();
validator.validate(json, compiledSchema)
.then(function(report){

@@ -133,7 +139,9 @@ // ...

```javascript
zSchema.registerFormat('xstring', function (str) {
var validator = new ZSchema();
ZSchema.registerFormat('xstring', function (str) {
return str === 'xxx'; // return true/false as a result of validation
});
zSchema.validate('xxx', {
validator.validate('xxx', {
'type': 'string',

@@ -151,3 +159,3 @@ 'format': 'xstring'

```javascript
zSchema.registerFormat('xstring', function (str) {
ZSchema.registerFormat('xstring', function (str) {
return Q.delay(1000).thenResolve(return str === 'xxx'); // return a promise for validation result

@@ -160,3 +168,3 @@ });

```javascript
zSchema.registerFormat('xstring', function (str, callback) {
ZSchema.registerFormat('xstring', function (str, callback) {
setTimeout(function(){

@@ -171,3 +179,3 @@ callback(null, str === 'xxx');

```javascript
zSchema.registerFormat('xstring', function (str) {
ZSchema.registerFormat('xstring', function (str) {
throw new Error('Bad, bad value!');

@@ -191,3 +199,3 @@ });

```javascript
var validator = new zSchema({
var validator = new ZSchema({
option: true

@@ -228,3 +236,3 @@ });

```javascript
var validator = new zSchema({
var validator = new ZSchema({
strict: true

@@ -231,0 +239,0 @@ });

Sorry, the diff of this file is too big to display

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