Socket
Socket
Sign inDemoInstall

joi

Package Overview
Dependencies
Maintainers
3
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 1.2.2 to 1.2.3

0

CONTRIBUTING.md

@@ -0,0 +0,0 @@ # How to contribute

@@ -0,0 +0,0 @@ {

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

9

lib/index.js

@@ -38,2 +38,3 @@ // Load modules

var settings = Utils.clone(exports.settings);
var localSettings = {};

@@ -47,3 +48,3 @@ if (!(config instanceof Types.Base)) {

if (typeof config[name] === internals.joiConfig[name]) {
settings[name] = config[name];
localSettings[name] = settings[name] = config[name];
delete config[name];

@@ -136,3 +137,9 @@ }

var names = Object.keys(localSettings);
for (var i = 0, il = names.length; i < il; ++ i) {
var name = names[i];
config[name] = localSettings[name];
}
return errors.toError();
};

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

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

3

lib/types/string.js

@@ -95,7 +95,6 @@ // Load modules

Utils.assert(n >= 0, 'In Types.String.max(n), the n must be a non-negative integer');
this.__valids.remove(undefined);
return function (value, obj, key, errors, keyPath) {
var result = value !== null && typeof value !== 'undefined' && (value.length <= n);
var result = value !== null && (value.length <= n);
if (!result) {

@@ -102,0 +101,0 @@ errors.addLocalized('string.max', key, {

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

{
"name": "joi",
"description": "Object schema validation",
"version": "1.2.2",
"version": "1.2.3",
"repository": "git://github.com/spumko/joi",

@@ -6,0 +6,0 @@ "main": "index",

@@ -0,0 +0,0 @@ <a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a>

@@ -586,2 +586,33 @@ // Load modules

it('should pass validation with extra keys set locally', function (done) {
expect(Joi.settings.stripExtraKeys).to.equal(false);
var localConfig = {
a: Joi.types.Number().min(0).max(3),
b: Joi.types.String().valid('a', 'b', 'c'),
allowExtraKeys: true
};
var obj = {
a: 1,
b: 'a',
d: 'c'
};
var err = Joi.validate(obj, localConfig);
expect(err).to.be.null;
expect(obj).to.deep.equal({a: 1, b: 'a', d: 'c'});
expect(Joi.settings.stripExtraKeys).to.equal(false);
err = Joi.validate(obj, localConfig);
expect(err).to.be.null;
expect(obj).to.deep.equal({a: 1, b: 'a', d: 'c'});
expect(Joi.settings.stripExtraKeys).to.equal(false);
done();
});
it('should pass validation with extra keys and remove them when skipExtraKeys is set locally', function (done) {

@@ -609,2 +640,8 @@

err = Joi.validate(obj, localConfig);
expect(err).to.be.null;
expect(obj).to.deep.equal({a: 1, b: 'a'});
expect(Joi.settings.stripExtraKeys).to.equal(false);
done();

@@ -611,0 +648,0 @@ });

@@ -0,0 +0,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

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

@@ -151,10 +151,2 @@ // Load modules

it('should invalid undefined if max set', function (done) {
var t = S().max(3);
verifyBehavior(t, [
[undefined, false]
], done);
});
it('should invalidate invalid values', function (done) {

@@ -226,2 +218,10 @@

it('should return true with max and not required when value is undefined', function (done) {
var t = S().max(3);
verifyBehavior(t, [
[undefined, true]
], done);
});
it('should validate regex', function (done) {

@@ -396,2 +396,13 @@

it('should handle combination of nullOk and max', function (done) {
var rule = S().nullOk().max(3);
verifyBehavior(rule, [
['x', true],
['123', true],
['1234', false],
['', false],
[null, true]
], done);
});
it('should handle combination of min and max', function (done) {

@@ -398,0 +409,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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