Comparing version 0.2.3 to 0.2.4
@@ -163,3 +163,3 @@ // Load modules | ||
for (var i = acceptable.length - 1; i >= 0; --i) { | ||
Utils.assert(this.validate(acceptable[i]) == true, 'input to .valid() must be valid ' + this.__name + '(' + acceptable[i] + ')'); | ||
Utils.assert(this.validate(acceptable[i]) === true, 'input to .valid() must be valid ' + this.__name + '(' + acceptable[i] + ')'); | ||
this.allow(acceptable[i]); | ||
@@ -384,3 +384,3 @@ } | ||
return typeof valid === 'undefined' ? 'undefined' : valid.toString(); | ||
return typeof valid === 'undefined' ? 'undefined' : valid === null ? 'null' : valid.toString(); | ||
}); | ||
@@ -387,0 +387,0 @@ |
{ | ||
"name": "joi", | ||
"description": "Object schema validation", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"author": "Van Nguyen <the.gol.effect@gmail.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -121,2 +121,20 @@ // Load modules | ||
it('should validate an array of valid types', function (done) { | ||
var config = { | ||
auth: [ | ||
Joi.types.Object({ | ||
mode: T.String().valid('required', 'optional', 'try').optional().nullOk() | ||
}).optional().nullOk(), | ||
T.String().optional().nullOk(), | ||
T.Boolean().optional().nullOk() | ||
] | ||
}; | ||
expect(Joi.validate({ auth: { mode: 'none' } }, config)).to.not.be.null; | ||
expect(Joi.validate({ auth: { mode: 'try' } }, config)).to.be.null; | ||
done(); | ||
}); | ||
it('should validate object successfully when config has an array of types', function (done) { | ||
@@ -123,0 +141,0 @@ |
@@ -5,3 +5,2 @@ // Load modules | ||
var Joi = require('../../lib'); | ||
var Object = require('../../lib/types/object'); | ||
var Support = require('../support/meta'); | ||
@@ -29,3 +28,3 @@ | ||
var O = Object; // Joi.types.Object; | ||
var O = Joi.types.Object; | ||
@@ -32,0 +31,0 @@ it('should have mixins', function (done) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
279420
3005