schema-inspector
Advanced tools
Comparing version 1.4.3 to 1.4.4
@@ -1172,3 +1172,3 @@ /* | ||
if (i in schema && typeof this._custom[i] === 'function') { | ||
post = this._custom[i].call(this, schema, candidate); | ||
post = this._custom[i].call(this, schema, post); | ||
} | ||
@@ -1175,0 +1175,0 @@ }, this); |
{ | ||
"name": "schema-inspector", | ||
"description": "Schema-Inspector is a powerful tool to sanitize and validate JS objects.", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"main": "./lib/schema-inspector.js", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -1183,16 +1183,13 @@ var should = require('should'); | ||
var custom = { | ||
superiorMod: function (schema, post, callback) { | ||
superiorMod: function (schema, post) { | ||
var spm = schema.$superiorMod; | ||
if (typeof spm !== 'number' || typeof post !== 'number') { | ||
callback(); | ||
return post; | ||
} | ||
var self = this; | ||
process.nextTick(function () { | ||
var mod = post % spm; | ||
if (mod !== 0) { | ||
self.report(); | ||
return callback(null, post + spm - mod); | ||
} | ||
callback(null, post); | ||
}); | ||
var mod = post % spm; | ||
if (mod !== 0) { | ||
this.report(); | ||
return (post + spm - mod); | ||
} | ||
return post; | ||
} | ||
@@ -1208,9 +1205,7 @@ }; | ||
si.sanitize(schema, candidate, function (err, result) { | ||
should.not.exist(err); | ||
result.should.be.an.Object; | ||
result.should.have.property('reporting').with.be.an.instanceof(Array) | ||
.and.be.lengthOf(0); | ||
done(); | ||
}); | ||
var result = si.sanitize(schema, candidate); | ||
result.should.be.an.Object; | ||
result.should.have.property('reporting').with.be.an.instanceof(Array) | ||
.and.be.lengthOf(0); | ||
done(); | ||
}); | ||
@@ -1223,11 +1218,9 @@ | ||
si.sanitize(schema, candidate, function (err, result) { | ||
should.not.exist(err); | ||
result.should.be.an.Object; | ||
result.should.have.property('reporting').with.be.an.instanceof(Array) | ||
.and.be.lengthOf(1); | ||
result.reporting[0].property.should.be.equal('@.lorem'); | ||
candidate.lorem.should.equal(10); | ||
done(); | ||
}); | ||
var result = si.sanitize(schema, candidate); | ||
result.should.be.an.Object; | ||
result.should.have.property('reporting').with.be.an.instanceof(Array) | ||
.and.be.lengthOf(1); | ||
result.reporting[0].property.should.be.equal('@.lorem'); | ||
candidate.lorem.should.equal(10); | ||
done(); | ||
}); | ||
@@ -1234,0 +1227,0 @@ |
296777
5261