n-deep-merge
Advanced tools
Comparing version 0.0.1 to 0.0.2
10
merge.js
@@ -20,8 +20,10 @@ /*! | ||
deepmerge = function (dest) { | ||
function deepmerge(dest) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
if (!source && typeof source !== 'boolean') | ||
if (!source && !~['boolean', 'string', 'number'].indexOf(typeof source)) { | ||
continue; | ||
} | ||
@@ -41,3 +43,3 @@ var isObj = typeof source === 'object', | ||
for (var key in source) { | ||
dest[key] = this.deepmerge(dest[key], source[key]); | ||
dest[key] = deepmerge(dest[key], source[key]); | ||
} | ||
@@ -49,5 +51,5 @@ } else { | ||
return dest; | ||
}; | ||
} | ||
return deepmerge; | ||
})); |
{ | ||
"name": "n-deep-merge", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "deep merge a collection of javascript objects and arrays", | ||
@@ -5,0 +5,0 @@ "main": "merge.js", |
# n-deep-merge | ||
[![Build Status](https://travis-ci.org/eclifford/bronson.svg?branch=master)](https://travis-ci.org/eclifford/bronson) | ||
[![Coverage Status](https://coveralls.io/repos/eclifford/bronson/badge.png?branch=master)](https://coveralls.io/r/eclifford/bronson?branch=master) | ||
[![Build Status](https://travis-ci.org/eclifford/n-deep-merge.svg?branch=master)](https://travis-ci.org/eclifford/n-deep-merge) | ||
@@ -21,3 +20,3 @@ ## What is n-deep-merge? | ||
```javascript | ||
var merge = require('deep-merge'); | ||
var merge = require('n-deep-merge'); | ||
@@ -24,0 +23,0 @@ var foo = { |
@@ -130,2 +130,9 @@ var expect = require('chai').expect; | ||
}); | ||
it('should merge properties with the number 0 or an empty string', function() { | ||
var obj1 = {foo: 0, bar: true}, | ||
obj2 = {baz: 1, test: ''}; | ||
var obj3 = merge(obj2, obj1); | ||
expect(obj3).to.deep.equal({foo: 0, bar: true, baz: 1, test: ''}); | ||
}); | ||
}); |
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
7247
195
110