Socket
Socket
Sign inDemoInstall

hoek

Package Overview
Dependencies
Maintainers
3
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hoek - npm Package Compare versions

Comparing version 2.9.0 to 2.9.1

2

index.js

@@ -1,1 +0,1 @@

module.exports = require('./lib');
module.exports = require('./lib');

@@ -132,2 +132,2 @@ // Declare internals

return safe;
}());
}());

@@ -174,6 +174,28 @@ // Load modules

return internals.withShallow(source, keys, function () {
// Move shallow copy items to storage
return exports.clone(source);
});
var storage = {};
for (var i = 0, il = keys.length; i < il; ++i) {
var key = keys[i];
if (source.hasOwnProperty(key)) {
storage[key] = source[key];
source[key] = undefined;
}
}
// Deep copy the rest
var copy = exports.clone(source);
// Shallow copy the stored items and restore
for (i = 0; i < il; ++i) {
key = keys[i];
if (storage.hasOwnProperty(key)) {
source[key] = storage[key];
copy[key] = storage[key];
}
}
return copy;
};

@@ -186,10 +208,15 @@

return internals.withShallow(options, keys, function () {
exports.assert(defaults && typeof defaults === 'object', 'Invalid defaults value: must be an object');
exports.assert(!options || options === true || typeof options === 'object', 'Invalid options value: must be true, falsy or an object');
exports.assert(keys && Array.isArray(keys), 'Invalid keys');
return exports.applyToDefaults(defaults, options);
});
};
if (!options) { // If no options, return null
return null;
}
var copy = exports.cloneWithShallow(defaults, keys);
internals.withShallow = function (source, keys, clone) {
if (options === true) { // If options is set to true, use defaults
return copy;
}

@@ -201,5 +228,5 @@ // Move shallow copy items to storage

var key = keys[i];
if (source.hasOwnProperty(key)) {
storage[key] = source[key];
source[key] = undefined;
if (options.hasOwnProperty(key)) {
storage[key] = options[key];
options[key] = undefined;
}

@@ -210,3 +237,3 @@ }

var copy = clone();
exports.merge(copy, options, false, false);

@@ -216,5 +243,5 @@ // Shallow copy the stored items

for (i = 0; i < il; ++i) {
var key = keys[i];
key = keys[i];
if (storage.hasOwnProperty(key)) {
source[key] = storage[key];
options[key] = storage[key];
copy[key] = storage[key];

@@ -282,4 +309,4 @@ }

for (var i = 0, il = obj.length; i < il; ++i) {
if (obj[i] !== ref[i]) {
for (var j = 0, jl = obj.length; j < jl; ++j) {
if (obj[j] !== ref[j]) {
return false;

@@ -305,4 +332,4 @@ }

var keys = Object.keys(obj);
for (var i = 0, l = keys.length; i < l; ++i) {
var key = keys[i];
for (var k = 0, kl = keys.length; k < kl; ++k) {
var key = keys[k];
var descriptor = Object.getOwnPropertyDescriptor(obj, key);

@@ -451,8 +478,8 @@ if (descriptor.get) {

for (i = 0, il = ref.length; i < il; ++i) {
for (var j = 0, jl = values.length, found = false; j < jl && found === false; ++j) {
found = compare(ref[i], values[j]) && j;
for (var j = 0, jl = values.length, matched = false; j < jl && matched === false; ++j) {
matched = compare(ref[i], values[j]) && j;
}
if (found !== false) {
++matches[found]
if (matched !== false) {
++matches[matched];
}

@@ -468,4 +495,4 @@ else {

var key = keys[i];
var found = values.indexOf(key);
if (found !== -1) {
var pos = values.indexOf(key);
if (pos !== -1) {
if (valuePairs &&

@@ -477,3 +504,3 @@ !compare(ref[key], valuePairs[key])) {

++matches[found]
++matches[pos];
}

@@ -487,3 +514,3 @@ else {

var result = false;
for (var i = 0, il = matches.length; i < il; ++i) {
for (i = 0, il = matches.length; i < il; ++i) {
result = result || !!matches[i];

@@ -591,3 +618,3 @@ if ((options.once && matches[i] > 1) ||

var capture = {};
Error.captureStackTrace(capture, arguments.callee);
Error.captureStackTrace(capture, arguments.callee); /*eslint no-caller:0 */
var stack = capture.stack;

@@ -838,3 +865,3 @@

exports.assert(source == null || typeof source === 'object', 'Invalid source object: must be null, undefined, or an object');
exports.assert(source === null || source === undefined || typeof source === 'object', 'Invalid source object: must be null, undefined, or an object');

@@ -841,0 +868,0 @@ var result = {};

{
"name": "hoek",
"description": "General purpose node utilities",
"version": "2.9.0",
"version": "2.9.1",
"repository": "git://github.com/hapijs/hoek",

@@ -15,3 +15,4 @@ "main": "index",

"devDependencies": {
"lab": "4.x.x"
"code": "1.x.x",
"lab": "5.x.x"
},

@@ -18,0 +19,0 @@ "scripts": {

// Load modules
var Code = require('code');
var Hoek = require('../lib');
var Lab = require('lab');
var Hoek = require('../lib');

@@ -15,5 +16,5 @@

var lab = exports.lab = Lab.script();
var expect = Lab.expect;
var describe = lab.experiment;
var it = lab.test;
var expect = Code.expect;

@@ -89,4 +90,1 @@

});
// Load modules
var Fs = require('fs');
var Lab = require('lab');
var Path = require('path');
var Code = require('code');
var Hoek = require('../lib');
var Lab = require('lab');

@@ -17,5 +18,5 @@

var lab = exports.lab = Lab.script();
var expect = Lab.expect;
var describe = lab.experiment;
var it = lab.test;
var expect = Code.expect;

@@ -74,6 +75,6 @@

var test = (function () {
var test = function () {
var b = Hoek.clone(a);
});
};

@@ -103,4 +104,3 @@ expect(test).to.not.throw();

var obj = {};
obj.__proto__ = null;
var obj = Object.create(null);
var b = Hoek.clone(obj);

@@ -112,12 +112,2 @@

it('clones an object with an undefined prototype', function (done) {
var obj = {};
obj.__proto__ = undefined;
var b = Hoek.clone(obj);
expect(b).to.deep.equal(obj);
done();
});
it('clones deeply nested object', function (done) {

@@ -390,3 +380,3 @@

expect(a.x[0]).to.equal('n');
expect(a.x.n).to.not.exist;
expect(a.x.n).to.not.exist();
done();

@@ -410,3 +400,3 @@ });

expect(a.x.n).to.equal('1');
expect(a.x[0]).to.not.exist;
expect(a.x[0]).to.not.exist();
done();

@@ -433,3 +423,3 @@ });

var a = {};
var b = undefined;
var b;
var c = null;

@@ -725,2 +715,86 @@

});
it('shallow copies the listed keys in the defaults', function (done) {
var defaults = {
a: {
b: 1
}
};
var merged = Hoek.applyToDefaultsWithShallow(defaults, {}, ['a']);
expect(merged.a).to.equal(defaults.a);
done();
});
it('shallow copies the listed keys in the defaults (true)', function (done) {
var defaults = {
a: {
b: 1
}
};
var merged = Hoek.applyToDefaultsWithShallow(defaults, true, ['a']);
expect(merged.a).to.equal(defaults.a);
done();
});
it('returns null on false', function (done) {
var defaults = {
a: {
b: 1
}
};
var merged = Hoek.applyToDefaultsWithShallow(defaults, false, ['a']);
expect(merged).to.equal(null);
done();
});
it('throws on missing defaults', function (done) {
expect(function () {
Hoek.applyToDefaultsWithShallow(null, {}, ['a']);
}).to.throw('Invalid defaults value: must be an object');
done();
});
it('throws on invalid defaults', function (done) {
expect(function () {
Hoek.applyToDefaultsWithShallow('abc', {}, ['a']);
}).to.throw('Invalid defaults value: must be an object');
done();
});
it('throws on invalid options', function (done) {
expect(function () {
Hoek.applyToDefaultsWithShallow({}, 'abc', ['a']);
}).to.throw('Invalid options value: must be true, falsy or an object');
done();
});
it('throws on missing keys', function (done) {
expect(function () {
Hoek.applyToDefaultsWithShallow({}, true);
}).to.throw('Invalid keys');
done();
});
it('throws on invalid keys', function (done) {
expect(function () {
Hoek.applyToDefaultsWithShallow({}, true, 'a');
}).to.throw('Invalid keys');
done();
});
});

@@ -732,14 +806,14 @@

expect(Hoek.deepEqual('x', 'x')).to.be.true;
expect(Hoek.deepEqual('x', 'y')).to.be.false;
expect(Hoek.deepEqual('x1', 'x')).to.be.false;
expect(Hoek.deepEqual(-0, +0)).to.be.false;
expect(Hoek.deepEqual(-0, -0)).to.be.true;
expect(Hoek.deepEqual(+0, +0)).to.be.true;
expect(Hoek.deepEqual(+0, -0)).to.be.false;
expect(Hoek.deepEqual(1, 1)).to.be.true;
expect(Hoek.deepEqual(0, 0)).to.be.true;
expect(Hoek.deepEqual(-1, 1)).to.be.false;
expect(Hoek.deepEqual(NaN, 0)).to.be.false;
expect(Hoek.deepEqual(NaN, NaN)).to.be.true;
expect(Hoek.deepEqual('x', 'x')).to.be.true();
expect(Hoek.deepEqual('x', 'y')).to.be.false();
expect(Hoek.deepEqual('x1', 'x')).to.be.false();
expect(Hoek.deepEqual(-0, +0)).to.be.false();
expect(Hoek.deepEqual(-0, -0)).to.be.true();
expect(Hoek.deepEqual(+0, +0)).to.be.true();
expect(Hoek.deepEqual(+0, -0)).to.be.false();
expect(Hoek.deepEqual(1, 1)).to.be.true();
expect(Hoek.deepEqual(0, 0)).to.be.true();
expect(Hoek.deepEqual(-1, 1)).to.be.false();
expect(Hoek.deepEqual(NaN, 0)).to.be.false();
expect(Hoek.deepEqual(NaN, NaN)).to.be.true();
done();

@@ -750,8 +824,8 @@ });

expect(Hoek.deepEqual([], 5)).to.be.false;
expect(Hoek.deepEqual(5, [])).to.be.false;
expect(Hoek.deepEqual({}, null)).to.be.false;
expect(Hoek.deepEqual(null, {})).to.be.false;
expect(Hoek.deepEqual('abc', {})).to.be.false;
expect(Hoek.deepEqual({}, 'abc')).to.be.false;
expect(Hoek.deepEqual([], 5)).to.be.false();
expect(Hoek.deepEqual(5, [])).to.be.false();
expect(Hoek.deepEqual({}, null)).to.be.false();
expect(Hoek.deepEqual(null, {})).to.be.false();
expect(Hoek.deepEqual('abc', {})).to.be.false();
expect(Hoek.deepEqual({}, 'abc')).to.be.false();
done();

@@ -762,5 +836,5 @@ });

expect(Hoek.deepEqual([], [])).to.be.true;
expect(Hoek.deepEqual({}, {})).to.be.true;
expect(Hoek.deepEqual([], {})).to.be.false;
expect(Hoek.deepEqual([], [])).to.be.true();
expect(Hoek.deepEqual({}, {})).to.be.true();
expect(Hoek.deepEqual([], {})).to.be.false();
done();

@@ -773,3 +847,3 @@ });

expect(Hoek.deepEqual([], arguments)).to.be.false;
expect(Hoek.deepEqual([], arguments)).to.be.false();
};

@@ -789,3 +863,3 @@

expect(Hoek.deepEqual(arg1, arguments)).to.be.true;
expect(Hoek.deepEqual(arg1, arguments)).to.be.true();
};

@@ -802,5 +876,5 @@

expect(Hoek.deepEqual(new Date(), new Date())).to.be.true;
expect(Hoek.deepEqual(new Date(100), new Date(101))).to.be.false;
expect(Hoek.deepEqual(new Date(), {})).to.be.false;
expect(Hoek.deepEqual(new Date(), new Date())).to.be.true();
expect(Hoek.deepEqual(new Date(100), new Date(101))).to.be.false();
expect(Hoek.deepEqual(new Date(), {})).to.be.false();
done();

@@ -811,7 +885,7 @@ });

expect(Hoek.deepEqual(/\s/, new RegExp('\\\s'))).to.be.true;
expect(Hoek.deepEqual(/\s/g, /\s/g)).to.be.true;
expect(Hoek.deepEqual(/a/, {})).to.be.false;
expect(Hoek.deepEqual(/\s/g, /\s/i)).to.be.false;
expect(Hoek.deepEqual(/a/g, /b/g)).to.be.false;
expect(Hoek.deepEqual(/\s/, new RegExp('\\\s'))).to.be.true();
expect(Hoek.deepEqual(/\s/g, /\s/g)).to.be.true();
expect(Hoek.deepEqual(/a/, {})).to.be.false();
expect(Hoek.deepEqual(/\s/g, /\s/i)).to.be.false();
expect(Hoek.deepEqual(/a/g, /b/g)).to.be.false();
done();

@@ -822,7 +896,7 @@ });

expect(Hoek.deepEqual([[1]], [[1]])).to.be.true;
expect(Hoek.deepEqual([1, 2, 3], [1, 2, 3])).to.be.true;
expect(Hoek.deepEqual([1, 2, 3], [1, 3, 2])).to.be.false;
expect(Hoek.deepEqual([1, 2, 3], [1, 2])).to.be.false;
expect(Hoek.deepEqual([1], [1])).to.be.true;
expect(Hoek.deepEqual([[1]], [[1]])).to.be.true();
expect(Hoek.deepEqual([1, 2, 3], [1, 2, 3])).to.be.true();
expect(Hoek.deepEqual([1, 2, 3], [1, 3, 2])).to.be.false();
expect(Hoek.deepEqual([1, 2, 3], [1, 2])).to.be.false();
expect(Hoek.deepEqual([1], [1])).to.be.true();
done();

@@ -833,7 +907,7 @@ });

expect(Hoek.deepEqual(new Buffer([1, 2, 3]), new Buffer([1, 2, 3]))).to.be.true;
expect(Hoek.deepEqual(new Buffer([1, 2, 3]), new Buffer([1, 3, 2]))).to.be.false;
expect(Hoek.deepEqual(new Buffer([1, 2, 3]), new Buffer([1, 2]))).to.be.false;
expect(Hoek.deepEqual(new Buffer([1, 2, 3]), {})).to.be.false;
expect(Hoek.deepEqual(new Buffer([1, 2, 3]), [1, 2, 3])).to.be.false;
expect(Hoek.deepEqual(new Buffer([1, 2, 3]), new Buffer([1, 2, 3]))).to.be.true();
expect(Hoek.deepEqual(new Buffer([1, 2, 3]), new Buffer([1, 3, 2]))).to.be.false();
expect(Hoek.deepEqual(new Buffer([1, 2, 3]), new Buffer([1, 2]))).to.be.false();
expect(Hoek.deepEqual(new Buffer([1, 2, 3]), {})).to.be.false();
expect(Hoek.deepEqual(new Buffer([1, 2, 3]), [1, 2, 3])).to.be.false();
done();

@@ -844,5 +918,5 @@ });

expect(Hoek.deepEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).to.be.true;
expect(Hoek.deepEqual({ foo: 'bar' }, { foo: 'baz' })).to.be.false;
expect(Hoek.deepEqual({ foo: { bar: 'foo' } }, { foo: { bar: 'baz' } })).to.be.false;
expect(Hoek.deepEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).to.be.true();
expect(Hoek.deepEqual({ foo: 'bar' }, { foo: 'baz' })).to.be.false();
expect(Hoek.deepEqual({ foo: { bar: 'foo' } }, { foo: { bar: 'baz' } })).to.be.false();
done();

@@ -857,3 +931,3 @@ });

var b = Hoek.clone(a);
expect(Hoek.deepEqual(a, b)).to.be.true;
expect(Hoek.deepEqual(a, b)).to.be.true();
done();

@@ -879,3 +953,3 @@ });

var copy = Hoek.clone(obj);
expect(Hoek.deepEqual(obj, copy)).to.be.true;
expect(Hoek.deepEqual(obj, copy)).to.be.true();
expect(execCount).to.equal(0);

@@ -903,3 +977,3 @@ expect(copy.test).to.equal(1);

expect(Hoek.deepEqual(obj, ref)).to.be.false;
expect(Hoek.deepEqual(obj, ref)).to.be.false();
done();

@@ -924,5 +998,5 @@ });

expect(Hoek.deepEqual(new Obj(), new Ref())).to.be.false;
expect(Hoek.deepEqual(new Obj(), new Obj())).to.be.true;
expect(Hoek.deepEqual(new Ref(), new Ref())).to.be.true;
expect(Hoek.deepEqual(new Obj(), new Ref())).to.be.false();
expect(Hoek.deepEqual(new Obj(), new Obj())).to.be.true();
expect(Hoek.deepEqual(new Ref(), new Ref())).to.be.true();
done();

@@ -939,4 +1013,4 @@ });

expect(Hoek.deepEqual(a, b)).to.be.true;
expect(Hoek.deepEqual(a, { b: 'c' })).to.be.false;
expect(Hoek.deepEqual(a, b)).to.be.true();
expect(Hoek.deepEqual(a, { b: 'c' })).to.be.false();
done();

@@ -1041,15 +1115,15 @@ });

expect(Hoek.contain('abc', 'ab')).to.be.true;
expect(Hoek.contain('abc', 'abc', { only: true })).to.be.true;
expect(Hoek.contain('aaa', 'a', { only: true })).to.be.true;
expect(Hoek.contain('abc', 'b', { once: true })).to.be.true;
expect(Hoek.contain('abc', ['a', 'c'])).to.be.true;
expect(Hoek.contain('abc', ['a', 'd'], { part: true })).to.be.true;
expect(Hoek.contain('abc', 'ab')).to.be.true();
expect(Hoek.contain('abc', 'abc', { only: true })).to.be.true();
expect(Hoek.contain('aaa', 'a', { only: true })).to.be.true();
expect(Hoek.contain('abc', 'b', { once: true })).to.be.true();
expect(Hoek.contain('abc', ['a', 'c'])).to.be.true();
expect(Hoek.contain('abc', ['a', 'd'], { part: true })).to.be.true();
expect(Hoek.contain('abc', 'ac')).to.be.false;
expect(Hoek.contain('abcd', 'abc', { only: true })).to.be.false;
expect(Hoek.contain('aab', 'a', { only: true })).to.be.false;
expect(Hoek.contain('abb', 'b', { once: true })).to.be.false;
expect(Hoek.contain('abc', ['a', 'd'])).to.be.false;
expect(Hoek.contain('abc', ['ab', 'bc'])).to.be.false; // Overlapping values not supported
expect(Hoek.contain('abc', 'ac')).to.be.false();
expect(Hoek.contain('abcd', 'abc', { only: true })).to.be.false();
expect(Hoek.contain('aab', 'a', { only: true })).to.be.false();
expect(Hoek.contain('abb', 'b', { once: true })).to.be.false();
expect(Hoek.contain('abc', ['a', 'd'])).to.be.false();
expect(Hoek.contain('abc', ['ab', 'bc'])).to.be.false(); // Overlapping values not supported
done();

@@ -1060,21 +1134,21 @@ });

expect(Hoek.contain([1, 2, 3], 1)).to.be.true;
expect(Hoek.contain([{ a: 1 }], { a: 1 }, { deep: true })).to.be.true;
expect(Hoek.contain([1, 2, 3], [1, 2])).to.be.true;
expect(Hoek.contain([{ a: 1 }], [{ a: 1 }], { deep: true })).to.be.true;
expect(Hoek.contain([1, 1, 2], [1, 2], { only: true })).to.be.true;
expect(Hoek.contain([1, 2], [1, 2], { once: true })).to.be.true;
expect(Hoek.contain([1, 2, 3], [1, 4], { part: true })).to.be.true;
expect(Hoek.contain([[1], [2]], [[1]], { deep: true })).to.be.true;
expect(Hoek.contain([1, 2, 3], 1)).to.be.true();
expect(Hoek.contain([{ a: 1 }], { a: 1 }, { deep: true })).to.be.true();
expect(Hoek.contain([1, 2, 3], [1, 2])).to.be.true();
expect(Hoek.contain([{ a: 1 }], [{ a: 1 }], { deep: true })).to.be.true();
expect(Hoek.contain([1, 1, 2], [1, 2], { only: true })).to.be.true();
expect(Hoek.contain([1, 2], [1, 2], { once: true })).to.be.true();
expect(Hoek.contain([1, 2, 3], [1, 4], { part: true })).to.be.true();
expect(Hoek.contain([[1], [2]], [[1]], { deep: true })).to.be.true();
expect(Hoek.contain([1, 2, 3], 4)).to.be.false;
expect(Hoek.contain([{ a: 1 }], { a: 2 }, { deep: true })).to.be.false;
expect(Hoek.contain([{ a: 1 }], { a: 1 })).to.be.false;
expect(Hoek.contain([1, 2, 3], [4, 5])).to.be.false;
expect(Hoek.contain([[3], [2]], [[1]])).to.be.false;
expect(Hoek.contain([[1], [2]], [[1]])).to.be.false;
expect(Hoek.contain([{ a: 1 }], [{ a: 2 }], { deep: true })).to.be.false;
expect(Hoek.contain([1, 3, 2], [1, 2], { only: true })).to.be.false;
expect(Hoek.contain([1, 2, 2], [1, 2], { once: true })).to.be.false;
expect(Hoek.contain([0, 2, 3], [1, 4], { part: true })).to.be.false;
expect(Hoek.contain([1, 2, 3], 4)).to.be.false();
expect(Hoek.contain([{ a: 1 }], { a: 2 }, { deep: true })).to.be.false();
expect(Hoek.contain([{ a: 1 }], { a: 1 })).to.be.false();
expect(Hoek.contain([1, 2, 3], [4, 5])).to.be.false();
expect(Hoek.contain([[3], [2]], [[1]])).to.be.false();
expect(Hoek.contain([[1], [2]], [[1]])).to.be.false();
expect(Hoek.contain([{ a: 1 }], [{ a: 2 }], { deep: true })).to.be.false();
expect(Hoek.contain([1, 3, 2], [1, 2], { only: true })).to.be.false();
expect(Hoek.contain([1, 2, 2], [1, 2], { once: true })).to.be.false();
expect(Hoek.contain([0, 2, 3], [1, 4], { part: true })).to.be.false();
done();

@@ -1085,20 +1159,20 @@ });

expect(Hoek.contain({ a: 1, b: 2, c: 3 }, 'a')).to.be.true;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, ['a', 'c'])).to.be.true;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, ['a', 'b', 'c'], { only: true })).to.be.true;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1 })).to.be.true;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, c: 3 })).to.be.true;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, d: 4 }, { part: true })).to.be.true;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 }, { only: true })).to.be.true;
expect(Hoek.contain({ a: [1], b: [2], c: [3] }, { a: [1], c: [3] }, { deep: true })).to.be.true;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, 'a')).to.be.true();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, ['a', 'c'])).to.be.true();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, ['a', 'b', 'c'], { only: true })).to.be.true();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1 })).to.be.true();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, c: 3 })).to.be.true();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, d: 4 }, { part: true })).to.be.true();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 }, { only: true })).to.be.true();
expect(Hoek.contain({ a: [1], b: [2], c: [3] }, { a: [1], c: [3] }, { deep: true })).to.be.true();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, 'd')).to.be.false;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, ['a', 'd'])).to.be.false;
expect(Hoek.contain({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'b', 'c'], { only: true })).to.be.false;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 2 })).to.be.false;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 2, b: 2 }, { part: true })).to.be.false; // part does not ignore bad value
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, d: 3 })).to.be.false;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, d: 4 })).to.be.false;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 }, { only: true })).to.be.false;
expect(Hoek.contain({ a: [1], b: [2], c: [3] }, { a: [1], c: [3] })).to.be.false;
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, 'd')).to.be.false();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, ['a', 'd'])).to.be.false();
expect(Hoek.contain({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'b', 'c'], { only: true })).to.be.false();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 2 })).to.be.false();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 2, b: 2 }, { part: true })).to.be.false(); // part does not ignore bad value
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, d: 3 })).to.be.false();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, d: 4 })).to.be.false();
expect(Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 }, { only: true })).to.be.false();
expect(Hoek.contain({ a: [1], b: [2], c: [3] }, { a: [1], c: [3] })).to.be.false();
done();

@@ -1559,3 +1633,3 @@ });

expect(Hoek.base64urlDecode().message).to.exist;
expect(Hoek.base64urlDecode().message).to.exist();
done();

@@ -1566,3 +1640,3 @@ });

expect(Hoek.base64urlDecode('*').message).to.exist;
expect(Hoek.base64urlDecode('*').message).to.exist();
done();

@@ -1768,3 +1842,3 @@ });

expect(Hoek.ignore).to.exist;
expect(Hoek.ignore).to.exist();
expect(typeof Hoek.ignore).to.equal('function');

@@ -1779,3 +1853,3 @@ done();

expect(Hoek.inherits).to.exist;
expect(Hoek.inherits).to.exist();
expect(typeof Hoek.inherits).to.equal('function');

@@ -1790,3 +1864,3 @@ done();

expect(Hoek.format).to.exist;
expect(Hoek.format).to.exist();
expect(typeof Hoek.format).to.equal('function');

@@ -1815,3 +1889,3 @@ done();

title: 'Warehouse',
state: 'CA',
state: 'CA'
};

@@ -1905,3 +1979,3 @@

});
}).to.throw('All mappings must be "." delineated string');
}).to.throw('All mappings must be "." delineated strings');

@@ -1921,3 +1995,3 @@ done();

it('is safe to pass null or undefined', function (done) {
it('is safe to pass null', function (done) {

@@ -1929,2 +2003,10 @@ var result = Hoek.transform(null, {});

});
it('is safe to pass undefined', function (done) {
var result = Hoek.transform(undefined, {});
expect(result).to.deep.equal({});
done();
});
});

@@ -1938,4 +2020,4 @@

expect(result).to.exist;
expect(result).to.be.a('string');
expect(result).to.exist();
expect(result).to.be.a.string();
expect(result).to.contain('test/modules');

@@ -1942,0 +2024,0 @@ done();

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