Socket
Socket
Sign inDemoInstall

jsonschema

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonschema - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

24

lib/validator.js

@@ -80,4 +80,8 @@ 'use strict';

}
for (var key in schema) {
if (schema.hasOwnProperty(key) && options.skipAttributes.indexOf(key) === -1) {
var key, i;
var keys = Object.keys(schema);
var keysLength = keys.length;
for (i = 0; i < keysLength; i++) {
key = keys[i];
if (options.skipAttributes.indexOf(key) === -1) {
a = new Attribute(this, key, schema, instance, options.propertyName, options);

@@ -106,4 +110,8 @@ valid = a.validate();

} else {
for (var property in schema.properties) {
if (schema.properties.hasOwnProperty(property)) {
var property, i;
if (helpers.isDefined(schema.properties)) {
var keys = Object.keys(schema.properties);
var keysLength = keys.length;
for (i = 0; i < keysLength; i++) {
property = keys[i];
if (helpers.isDefined(instance) && !helpers.isNull(instance) && helpers.isDefined(instance[property])) {

@@ -122,3 +130,3 @@ prop = instance[property];

Validator.prototype.validateArray = function (instance, schema, options) {
var a, i;
var a, i, len;
// Don't validate undefined's

@@ -140,3 +148,3 @@ if (!helpers.isDefined(instance)) {

options.skipAttributes = [];
for (i = 0; i < instance.length; i++) {
for (i = 0, len = instance.length; i < len; i++) {
if (options && options.propertyName) {

@@ -151,5 +159,5 @@ options.propertyName = options.propertyName.concat("[", i, "]");

Validator.prototype.validateUnionType = function (instance, schema, options) {
var i;
var i, len;
var invalid;
for (i = 0; i < schema.type.length; i++) {
for (i = 0, len = schema.type.length; i < len; i++) {
if (typeof schema.type[i] === 'string') {

@@ -156,0 +164,0 @@ invalid = this.validateSchema(instance, {'type': schema.type[i]}, {'addError': false});

{
"author": "Tom de Grunt <tom@degrunt.nl>",
"name": "jsonschema",
"version": "0.0.1",
"version": "0.0.2",
"dependencies": {

@@ -6,0 +6,0 @@ "mocha": "~1.3.0",

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