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.2 to 0.2.3

23

lib/types/base.js

@@ -191,3 +191,7 @@ // Load modules

for (var i in peers) {
if (!obj.hasOwnProperty(peers[i]) || peers[i] === null) {
if (!obj.hasOwnProperty(peers[i]) ||
typeof(obj[peers[i]]) === 'undefined' ||
obj[peers[i]] === null ||
obj[peers[i]] === '') {
return false;

@@ -212,7 +216,2 @@ }

if (this.__modifiers.has('required')) {
this.optional();
return this._xor(peers);
}
return function (value, obj, key, errors, keyPath) {

@@ -227,2 +226,6 @@

if (this.__modifiers.has('required')) {
return this.xor(Array.prototype.slice.call(arguments));
}
this.add('without', this._without(Array.prototype.slice.call(arguments)), arguments);

@@ -240,3 +243,3 @@ return this;

var result = !!((typeof value !== 'undefined' && value !== null) ^ withFn(value, obj, key, errors, keyPath));
var result = !!((typeof value !== 'undefined' && value !== null && value !== '') ^ withFn(value, obj, key, errors, keyPath));

@@ -255,2 +258,6 @@ if (!result) {

this.add('xor', this._xor(Array.prototype.slice.call(arguments)), arguments);
this.__invalids.remove(undefined);
this.__invalids.remove(null);
this.__invalids.remove('');
return this;

@@ -373,3 +380,3 @@ };

}
if (this.__allowOnly === true &&

@@ -376,0 +383,0 @@ this.__valids._values.indexOf(value) < 0) {

@@ -0,0 +0,0 @@ // Load modules

@@ -39,3 +39,3 @@ // Load modules

var result = typeof value === 'string';
var result = typeof value === 'string' || value === null || typeof value === 'undefined';

@@ -42,0 +42,0 @@ if (!result) {

{
"name": "joi",
"description": "Object schema validation",
"version": "0.2.2",
"version": "0.2.3",
"author": "Van Nguyen <the.gol.effect@gmail.com>",

@@ -6,0 +6,0 @@ "contributors": [

@@ -85,2 +85,13 @@ // Load modules

expect(Joi.validate({ txt: 'test', upc: 'test' }, config5)).to.not.be.null;
expect(Joi.validate({ txt: 'test', upc: null }, config5)).to.be.null;
expect(Joi.validate({ txt: 'test', upc: '' }, config5)).to.be.null;
expect(Joi.validate({ txt: '', upc: 'test' }, config5)).to.be.null;
expect(Joi.validate({ txt: null, upc: 'test' }, config5)).to.be.null;
expect(Joi.validate({ txt: undefined, upc: 'test' }, config5)).to.be.null;
expect(Joi.validate({ txt: 'test', upc: undefined }, config5)).to.be.null;
expect(Joi.validate({ txt: 'test', upc: '' }, config5)).to.be.null;
expect(Joi.validate({ txt: 'test', upc: null }, config5)).to.be.null;
expect(Joi.validate({ txt: '', upc: undefined }, config5)).to.not.be.null;
expect(Joi.validate({ txt: '', upc: '' }, config5)).to.not.be.null;
done();

@@ -97,2 +108,13 @@ });

expect(Joi.validate({ txt: 'test', upc: 'test' }, config6)).to.not.be.null;
expect(Joi.validate({ txt: 'test', upc: null }, config6)).to.be.null;
expect(Joi.validate({ txt: 'test', upc: '' }, config6)).to.be.null;
expect(Joi.validate({ txt: '', upc: 'test' }, config6)).to.be.null;
expect(Joi.validate({ txt: null, upc: 'test' }, config6)).to.be.null;
expect(Joi.validate({ txt: undefined, upc: 'test' }, config6)).to.be.null;
expect(Joi.validate({ txt: 'test', upc: undefined }, config6)).to.be.null;
expect(Joi.validate({ txt: 'test', upc: '' }, config6)).to.be.null;
expect(Joi.validate({ txt: 'test', upc: null }, config6)).to.be.null;
expect(Joi.validate({ txt: '', upc: undefined }, config6)).to.not.be.null;
expect(Joi.validate({ txt: '', upc: '' }, config6)).to.not.be.null;
done();

@@ -99,0 +121,0 @@ });

@@ -0,0 +0,0 @@ // Load modules

@@ -0,0 +0,0 @@ // Load modules

@@ -0,0 +0,0 @@ // Load modules

@@ -0,0 +0,0 @@ // Load modules

@@ -0,0 +0,0 @@ // Load modules

@@ -0,0 +0,0 @@ // Load modules

@@ -0,0 +0,0 @@ // Load modules

@@ -0,0 +0,0 @@ // Load modules

@@ -0,0 +0,0 @@ // Load modules

@@ -0,0 +0,0 @@ // Load modules

Sorry, the diff of this file is not supported yet

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