Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.12.0 to 2.13.0

4

lib/index.js

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

exports.applyToDefaults = function (defaults, options) {
exports.applyToDefaults = function (defaults, options, isNullOverride) {

@@ -161,3 +161,3 @@ exports.assert(defaults && typeof defaults === 'object', 'Invalid defaults value: must be an object');

return exports.merge(copy, options, false, false);
return exports.merge(copy, options, isNullOverride === true, false);
};

@@ -164,0 +164,0 @@

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

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

@@ -16,3 +16,3 @@ ![hoek Logo](https://raw.github.com/hapijs/hoek/master/images/hoek.png)

* [merge](#mergetarget-source-isnulloverride-ismergearrays "merge")
* [applyToDefaults](#applytodefaultsdefaults-options "applyToDefaults")
* [applyToDefaults](#applytodefaultsdefaults-options-isnulloverride "applyToDefaults")
* [applyToDefaultsWithShallow](#applytodefaultswithshallowdefaults-options-keys "applyToDefaultsWithShallow")

@@ -151,3 +151,4 @@ * [deepEqual](#deepequala-b "deepEqual")

### applyToDefaults(defaults, options)
### applyToDefaults(defaults, options, isNullOverride)
isNullOverride defaults to false

@@ -164,2 +165,12 @@ Apply options to a copy of the defaults

Apply options with a null value to a copy of the defaults
```javascript
var defaults = { host: "localhost", port: 8000 };
var options = { host: null, port: 8080 };
var config = Hoek.applyToDefaults(defaults, options, true); // results in { host: null, port: 8080 }
```
### applyToDefaultsWithShallow(defaults, options, keys)

@@ -166,0 +177,0 @@ keys is an array of key names to shallow copy

@@ -636,2 +636,24 @@ // Load modules

});
it('applies object to defaults with null', function (done) {
var obj = {
a: null,
c: {
e: [4]
},
f: 0,
g: {
h: 5
}
};
var result = Hoek.applyToDefaults(defaults, obj, true);
expect(result.c.e).to.deep.equal([4]);
expect(result.a).to.equal(null);
expect(result.b).to.equal(2);
expect(result.f).to.equal(0);
expect(result.g).to.deep.equal({ h: 5 });
done();
});
});

@@ -638,0 +660,0 @@

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