jsonschema
Advanced tools
+1
-1
@@ -67,3 +67,3 @@ 'use strict'; | ||
| if (! res.valid && callback instanceof Function) { | ||
| if (!res.valid && callback instanceof Function) { | ||
| callback(res); | ||
@@ -70,0 +70,0 @@ } |
+2
-2
@@ -186,4 +186,4 @@ 'use strict'; | ||
| } | ||
| if (a instanceof Array) { | ||
| if (!(b instanceof Array)) { | ||
| if (Array.isArray(a)) { | ||
| if (!Array.isArray(b)) { | ||
| return false; | ||
@@ -190,0 +190,0 @@ } |
+1
-1
@@ -71,3 +71,3 @@ /* | ||
| minProperties?: number | ||
| required?: string[] | ||
| required?: string[] | boolean | ||
| additionalProperties?: boolean | Schema | ||
@@ -74,0 +74,0 @@ definitions?: { |
+3
-3
@@ -42,4 +42,4 @@ | ||
| } | ||
| scanArray(ourBase+'/items', ((schema.items instanceof Array)?schema.items:[schema.items])); | ||
| scanArray(ourBase+'/extends', ((schema.extends instanceof Array)?schema.extends:[schema.extends])); | ||
| scanArray(ourBase+'/items', (Array.isArray(schema.items)?schema.items:[schema.items])); | ||
| scanArray(ourBase+'/extends', (Array.isArray(schema.extends)?schema.extends:[schema.extends])); | ||
| scanSchema(ourBase+'/additionalItems', schema.additionalItems); | ||
@@ -58,3 +58,3 @@ scanObject(ourBase+'/properties', schema.properties); | ||
| function scanArray(baseuri, schemas){ | ||
| if(!(schemas instanceof Array)) return; | ||
| if(!Array.isArray(schemas)) return; | ||
| for(var i=0; i<schemas.length; i++){ | ||
@@ -61,0 +61,0 @@ scanSchema(baseuri+'/'+i, schemas[i]); |
+3
-3
@@ -66,3 +66,3 @@ 'use strict'; | ||
| Validator.prototype.addSubSchemaArray = function addSubSchemaArray(baseuri, schemas) { | ||
| if(!(schemas instanceof Array)) return; | ||
| if(!Array.isArray(schemas)) return; | ||
| for(var i=0; i<schemas.length; i++){ | ||
@@ -171,3 +171,3 @@ this.addSubSchema(baseuri, schemas[i]); | ||
| if (schema['extends']) { | ||
| if (schema['extends'] instanceof Array) { | ||
| if (Array.isArray(schema['extends'])) { | ||
| var schemaobj = {schema: schema, ctx: ctx}; | ||
@@ -319,5 +319,5 @@ schema['extends'].forEach(this.schemaTraverser.bind(this, schemaobj)); | ||
| // TODO: fix this - see #15 | ||
| return instance && (typeof instance) === 'object' && !(instance instanceof Array) && !(instance instanceof Date); | ||
| return instance && (typeof instance === 'object') && !(Array.isArray(instance)) && !(instance instanceof Date); | ||
| }; | ||
| module.exports = Validator; |
+1
-1
| { | ||
| "author": "Tom de Grunt <tom@degrunt.nl>", | ||
| "name": "jsonschema", | ||
| "version": "1.2.5", | ||
| "version": "1.2.6", | ||
| "license": "MIT", | ||
@@ -6,0 +6,0 @@ "dependencies": {}, |
+14
-2
@@ -80,3 +80,15 @@ [](http://travis-ci.org/tdegrunt/jsonschema) | ||
| ``` | ||
| ### Example for Array schema | ||
| ```json | ||
| var arraySchema = { | ||
| "type": "array", | ||
| "items": { | ||
| "properties": { | ||
| "name": { "type": "string" }, | ||
| "lastname": { "type": "string" } | ||
| }, | ||
| "required": ["name", "lastname"] | ||
| } | ||
| } | ||
| ``` | ||
| For a comprehensive, annotated example illustrating all possible validation options, see [examples/all.js](./examples/all.js) | ||
@@ -190,3 +202,3 @@ | ||
| if (schema.type && this.attributes.type.call(this, instance, schema, options, ctx.makeChild(schema, property))) { | ||
| var types = (schema.type instanceof Array) ? schema.type : [schema.type]; | ||
| var types = Array.isArray(schema.type) ? schema.type : [schema.type]; | ||
| var coerced = undefined; | ||
@@ -193,0 +205,0 @@ |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
63717
0.44%262
4.8%