Socket
Socket
Sign inDemoInstall

joi

Package Overview
Dependencies
Maintainers
2
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

4

lib/types/base.js

@@ -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) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc