schema-inspector
Advanced tools
Comparing version 1.4.5 to 1.4.6
{ | ||
"name": "schema-inspector", | ||
"version": "1.3.5", | ||
"version": "1.4.6", | ||
"homepage": "https://github.com/Atinux/schema-inspector", | ||
"authors": [ | ||
{ | ||
"name": "Sebastien Chopin", | ||
"name": "Aaron Blum", | ||
"email": "atinux@gmail.com", | ||
@@ -13,3 +13,3 @@ "homepage": "https://twitter.com/atinux" | ||
"description": "Schema-Inspector is a powerful tool to sanitize and validate JS objects.", | ||
"main": "./lib/schema-inspector.js", | ||
"main": "index.js", | ||
"keywords": [ | ||
@@ -32,4 +32,4 @@ "schema-inspector", | ||
"dependencies": { | ||
"async": "~0.2.5" | ||
"async": "*" | ||
} | ||
} |
@@ -815,2 +815,4 @@ /* | ||
strict: function (schema, post) { | ||
if (schema.strict !== true) | ||
return post; | ||
if (!_typeIs['object'](schema.properties)) | ||
@@ -817,0 +819,0 @@ return post; |
{ | ||
"name": "schema-inspector", | ||
"description": "Schema-Inspector is a powerful tool to sanitize and validate JS objects.", | ||
"version": "1.4.5", | ||
"main": "./lib/schema-inspector.js", | ||
"version": "1.4.6", | ||
"main": "index.js", | ||
"author": { | ||
"name": "Sebastien Chopin", | ||
"name": "Aaron Blum", | ||
"url" : "https://twitter.com/atinux" | ||
@@ -9,0 +9,0 @@ }, |
@@ -155,2 +155,3 @@ [![schema-inspector logo](https://raw2.github.com/Atinux/schema-inspector/master/misc/schema-inspector.png)](http://atinux.github.io/schema-inspector/) | ||
* [minLength, maxLength](#s_length) | ||
* [strict](#s_strict) | ||
* [exec](#s_exec) | ||
@@ -1001,2 +1002,38 @@ * [properties](#s_properties) | ||
<a name="s_strict" /> | ||
### strict | ||
* **type**: boolean. | ||
* **default**: false. | ||
* **usable on**: any. | ||
Only key provided in field "properties" will exist in object, others will be deleted. | ||
__Example__ | ||
```javascript | ||
var inspector = require('schema-inspector'); | ||
var schema = { | ||
type: 'object', | ||
strict: true, | ||
properties: { | ||
good: { type: 'string' } | ||
} | ||
}; | ||
var c = { | ||
good: 'yes', | ||
bad: 'nope' | ||
}; | ||
var r = inspector.sanitize(schema, c); | ||
/* | ||
c: { | ||
good: 'yes' | ||
} | ||
*/ | ||
``` | ||
--------------------------------------- | ||
<a name="s_exec" /> | ||
@@ -1003,0 +1040,0 @@ ### exec |
var should = require('should'); | ||
var si = require('../lib/schema-inspector'); | ||
var si = require('../'); | ||
@@ -4,0 +4,0 @@ const NB_TEST = 25; |
var should = require('should'); | ||
var si = require('../lib/schema-inspector'); | ||
var si = require('../'); | ||
@@ -4,0 +4,0 @@ exports.sanitization = function () { |
var should = require('should'); | ||
var si = require('../lib/schema-inspector'); | ||
var si = require('../'); | ||
@@ -4,0 +4,0 @@ exports.validation = function () { |
298800
21
5319
1304