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

jsonpolice

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonpolice - npm Package Compare versions

Comparing version 5.1.0 to 5.1.1

6

dist/schema_array.js

@@ -75,9 +75,9 @@ "use strict";

if (itemsIsArray && i < this.data.items.length) {
data[i] = yield this.data.items[i][global_1.__schema].validate(data[i], path + '/' + i);
data[i] = yield schema_1.Schema.get(this.data.items[i]).validate(data[i], path + '/' + i);
}
else if (itemsIsObject) {
data[i] = yield this.data.items[global_1.__schema].validate(data[i], path + '/' + i);
data[i] = yield schema_1.Schema.get(this.data.items).validate(data[i], path + '/' + i);
}
else if (addIsObject) {
data[i] = yield this.data.additionalItems[global_1.__schema].validate(data[i], path + '/' + i);
data[i] = yield schema_1.Schema.get(this.data.additionalItems).validate(data[i], path + '/' + i);
}

@@ -84,0 +84,0 @@ else if (this.data.additionalItems === false) {

@@ -128,3 +128,3 @@ "use strict";

found = true;
data[k] = yield this.data.properties[k][global_1.__schema].validate(data[k], path + '/' + k);
data[k] = yield schema_1.Schema.get(this.data.properties[k]).validate(data[k], path + '/' + k);
}

@@ -135,3 +135,3 @@ else if (global_1.enumerableAndDefined(this.data, 'patternProperties')) {

found = true;
data[k] = yield this.data.patternProperties[i][global_1.__schema].validate(data[k], path + '/' + k);
data[k] = yield schema_1.Schema.get(this.data.patternProperties[i]).validate(data[k], path + '/' + k);
}

@@ -150,3 +150,3 @@ }

else if (typeof this.data.additionalProperties === 'object') {
yield this.data.additionalProperties[global_1.__schema].validate(data[k], path + '/' + k);
yield schema_1.Schema.get(this.data.additionalProperties).validate(data[k], path + '/' + k);
}

@@ -153,0 +153,0 @@ }

@@ -11,2 +11,4 @@ import { SchemaOptions } from './global';

abstract validate(data: any, path: string): Promise<any>;
protected abstract init(): void;
abstract default(data?: any): any;
static factories: {

@@ -16,2 +18,4 @@ [type: string]: SchemaFactory;

static registerFactory(type: string, factory: SchemaFactory): void;
static attach(data: any, schema: Schema): void;
static get(data: any): Schema;
static create(data: any, opts?: SchemaOptions): Schema;

@@ -25,3 +29,3 @@ static flatten(data: any): any;

protected init(): void;
protected default(data: any): any;
default(data?: any): any;
schema(): Promise<any>;

@@ -28,0 +32,0 @@ validate(data: any, path?: string): Promise<any>;

@@ -69,2 +69,8 @@ "use strict";

}
static attach(data, schema) {
data[global_1.__schema] = schema;
}
static get(data) {
return data[global_1.__schema];
}
static create(data, opts = {}) {

@@ -97,3 +103,3 @@ let schema;

}
data[global_1.__schema] = schema;
Schema.attach(data, schema);
schema.init();

@@ -266,3 +272,3 @@ return schema;

for (let i = 0; !def && i < this.data.allOf.length; i++) {
def = this.data.allOf[i][global_1.__schema].default();
def = Schema.get(this.data.allOf[i]).default();
}

@@ -272,3 +278,3 @@ }

for (let i = 0; !def && i < this.data.anyOf.length; i++) {
def = this.data.anyOf[i][global_1.__schema].default();
def = Schema.get(this.data.anyOf[i]).default();
}

@@ -278,3 +284,3 @@ }

for (let i = 0; !def && i < this.data.oneOf.length; i++) {
def = this.data.oneOf[i][global_1.__schema].default();
def = Schema.get(this.data.oneOf[i]).default();
}

@@ -336,3 +342,3 @@ }

for (let i = 0; i < this.data.allOf.length; i++) {
data = yield this.data.allOf[i][global_1.__schema].validate(data, path);
data = yield Schema.get(this.data.allOf[i]).validate(data, path);
}

@@ -347,3 +353,3 @@ return data;

try {
_data = yield this.data.anyOf[i][global_1.__schema].validate(data, path);
_data = yield Schema.get(this.data.anyOf[i]).validate(data, path);
found = true;

@@ -364,3 +370,3 @@ }

try {
_data = yield this.data.oneOf[i][global_1.__schema].validate(data, path);
_data = yield Schema.get(this.data.oneOf[i]).validate(data, path);
count++;

@@ -379,3 +385,3 @@ }

try {
yield this.data.not[global_1.__schema].validate(data, path);
yield Schema.get(this.data.not).validate(data, path);
}

@@ -382,0 +388,0 @@ catch (e) {

{
"name": "jsonpolice",
"version": "5.1.0",
"version": "5.1.1",
"description": "JSON Schema parser and validator",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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