Comparing version 0.4.0 to 1.0.0
@@ -35,6 +35,11 @@ // Load modules | ||
internals.ObjectType.prototype.convert = function (value) { | ||
if (typeof value === 'object' || typeof value === 'undefined') { | ||
return value; | ||
} | ||
try { | ||
return (typeof value === 'object' || typeof value === 'undefined') ? value : JSON.parse(value); | ||
return JSON.parse(value); | ||
} | ||
catch(err) { | ||
catch (err) { | ||
return value; | ||
@@ -113,3 +118,3 @@ } | ||
var unprocessedKeys = Object.keys(unprocessedObject); | ||
for (var i = 0, il = unprocessedKeys.length; i < il; ++i) { | ||
for (i = 0, il = unprocessedKeys.length; i < il; ++i) { | ||
var unprocessedKey = unprocessedKeys[i]; | ||
@@ -116,0 +121,0 @@ |
{ | ||
"name": "joi", | ||
"description": "Object schema validation", | ||
"version": "0.4.0", | ||
"author": "Van Nguyen <the.gol.effect@gmail.com>", | ||
"contributors": [ | ||
"Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)", | ||
"Wyatt Preul <wpreul@gmail.com>" | ||
], | ||
"version": "1.0.0", | ||
"repository": "git://github.com/spumko/joi", | ||
@@ -11,0 +6,0 @@ "main": "index", |
@@ -148,2 +148,3 @@ // Load modules | ||
expect(Joi.validate('test@test.com', T.String().email())).to.be.null; | ||
expect(Joi.validate({ param: 'item'}, T.Object({ param: T.String().required() }, true))).to.be.null; | ||
@@ -155,3 +156,3 @@ done(); | ||
Joi.settings.saveConversions = true; | ||
var config = T.Object({ | ||
@@ -164,3 +165,3 @@ a: T.String() | ||
Joi.settings.saveConversions = false; | ||
done(); | ||
@@ -171,3 +172,3 @@ }); | ||
Joi.settings.saveConversions = true; | ||
var config = T.Object({ | ||
@@ -179,3 +180,3 @@ a: T.String() | ||
var validated = { a: 'okay' }; | ||
expect(Joi.validate(validated, config)).to.be.null; | ||
@@ -185,3 +186,3 @@ expect(validated).to.deep.equal(original); | ||
Joi.settings.saveConversions = false; | ||
done(); | ||
@@ -188,0 +189,0 @@ }); |
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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
302143
40
3549
1
2