Comparing version 0.14.0 to 0.14.1
@@ -5,2 +5,4 @@ /** | ||
var exists = require('./exists'); | ||
/** | ||
@@ -27,5 +29,5 @@ * Mixes in properties from source into target when | ||
return Object.keys(source).reduce(function (target, key) { | ||
target[key] = target[key] || source[key]; | ||
target[key] = exists(target[key]) ? target[key] : source[key]; | ||
return target; | ||
}, target); | ||
} |
{ | ||
"name": "101", | ||
"version": "0.14.0", | ||
"version": "0.14.1", | ||
"description": "common javascript utils that can be required selectively that assume es5+", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,3 +21,3 @@ ![101](http://i.imgur.com/MFrmMt6.png) | ||
### Why not release each as individual modules? | ||
I usually agree with this philosophy; however, while in practice, adherence to the module-pattern | ||
I usually agree with this philosophy; however, while in practice, adherence to the module-pattern | ||
can become quite annoying for micro-modules (like those in 101): | ||
@@ -135,2 +135,17 @@ * Micro-modules existance throughout a project can change very frequently, because of this one may find | ||
## defaults | ||
Fill non-existing object values with defaults. Use it to set defaults on options. | ||
Supports partial functionality (great with array functions). | ||
```js | ||
var defaults = require('101/defaults'); | ||
var opts = { foo: 0, bar: 1 }; | ||
var defs = { foo: 1, bar: 2, qux: 2 }; | ||
defaults(opts, defs); // { foo: 0, bar: 1, qux: 2 } | ||
[opts].map(defaults(defs)); // [ { foo: 0, bar: 1, qux: 2 } ] | ||
``` | ||
## del | ||
@@ -165,3 +180,2 @@ | ||
## envIs | ||
@@ -168,0 +182,0 @@ |
@@ -14,2 +14,3 @@ var Lab = require('lab'); | ||
foo: 1, | ||
bar: 4, | ||
qux: 3 | ||
@@ -19,2 +20,3 @@ }; | ||
var b = { | ||
foo: 0, | ||
bar: 2 | ||
@@ -26,3 +28,3 @@ }; | ||
expect(c).to.eql({ | ||
foo: 1, | ||
foo: 0, | ||
bar: 2, | ||
@@ -29,0 +31,0 @@ qux: 3 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100291
2988
604