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

merge-deep

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-deep - npm Package Compare versions

Comparing version 0.1.0 to 0.1.2

bower.json

20

.verbrc.md

@@ -27,2 +27,22 @@ # {%= name %} {%= badge("fury") %}

### Related projects
These are other projects I maintain:
- [arrayify-compact](https://github.com/jonschlinkert/arrayify-compact)
- [compact-object](https://github.com/jonschlinkert/compact-object)
- [delete](https://github.com/jonschlinkert/delete)
- [flatten-object](https://github.com/jonschlinkert/flatten-object)
- [for-in](https://github.com/jonschlinkert/for-in)
- [for-own](https://github.com/jonschlinkert/for-own)
- [has-any](https://github.com/jonschlinkert/has-any)
- [has-value](https://github.com/jonschlinkert/has-value)
- [is-number](https://github.com/jonschlinkert/is-number)
- [is-plain-object](https://github.com/jonschlinkert/is-plain-object)
- [mixin-deep](https://github.com/jonschlinkert/mixin-deep)
- [mixin-object](https://github.com/jonschlinkert/mixin-object)
- [object-length](https://github.com/jonschlinkert/object-length)
- [omit-empty](https://github.com/jonschlinkert/omit-empty)
- [reduce-object](https://github.com/jonschlinkert/reduce-object)
## License

@@ -29,0 +49,0 @@ {%= copyright() %}

24

index.js

@@ -13,11 +13,11 @@ /*!

module.exports = function merge() {
var target = cloneDeep(arguments[0]);
var len = arguments.length;
var key;
var val;
module.exports = function merge(orig, objects) {
var args = [].slice.call(arguments, 1);
var len = args.length;
var o = cloneDeep(orig);
for (var i = 0; i < len; i++) {
var obj = arguments[i];
for (key in obj) {
var obj = args[i];
for (var key in obj) {
if (!hasOwn(obj, key)) {

@@ -27,8 +27,8 @@ continue;

val = obj[key];
var val = obj[key];
if (isObject(val) && isObject(target[key])) {
target[key] = merge(target[key], val);
if (isObject(val) && isObject(o[key])) {
o[key] = merge(o[key], val);
} else {
target[key] = cloneDeep(val);
o[key] = cloneDeep(val);
}

@@ -38,3 +38,3 @@

}
return target;
return o;
};

@@ -41,0 +41,0 @@

{
"name": "merge-deep",
"description": "Recursively merge values in a javascript object.",
"version": "0.1.0",
"version": "0.1.2",
"homepage": "https://github.com/jonschlinkert/merge-deep",

@@ -45,3 +45,6 @@ "author": {

"deep-merge",
"extend",
"javascript",
"key",
"keys",
"merge",

@@ -51,2 +54,8 @@ "merge-deep",

"objects",
"prop",
"properties",
"property",
"props",
"regex",
"regexp",
"util",

@@ -56,9 +65,9 @@ "utilities",

"utils",
"value"
"value",
"values"
],
"dependencies": {
"clone-deep": "^0.1.0",
"is-plain-object": "^0.1.0",
"isobject": "^0.2.0"
"is-plain-object": "^0.1.0"
}
}
}

@@ -36,2 +36,22 @@ # merge-deep [![NPM version](https://badge.fury.io/js/merge-deep.svg)](http://badge.fury.io/js/merge-deep)

### Related projects
These are other projects I maintain:
- [arrayify-compact](https://github.com/jonschlinkert/arrayify-compact)
- [compact-object](https://github.com/jonschlinkert/compact-object)
- [delete](https://github.com/jonschlinkert/delete)
- [flatten-object](https://github.com/jonschlinkert/flatten-object)
- [for-in](https://github.com/jonschlinkert/for-in)
- [for-own](https://github.com/jonschlinkert/for-own)
- [has-any](https://github.com/jonschlinkert/has-any)
- [has-value](https://github.com/jonschlinkert/has-value)
- [is-number](https://github.com/jonschlinkert/is-number)
- [is-plain-object](https://github.com/jonschlinkert/is-plain-object)
- [mixin-deep](https://github.com/jonschlinkert/mixin-deep)
- [mixin-object](https://github.com/jonschlinkert/mixin-object)
- [object-length](https://github.com/jonschlinkert/object-length)
- [omit-empty](https://github.com/jonschlinkert/omit-empty)
- [reduce-object](https://github.com/jonschlinkert/reduce-object)
## License

@@ -43,2 +63,2 @@ Copyright (c) 2014 Jon Schlinkert, contributors.

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 02, 2014._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 07, 2014._

@@ -13,2 +13,4 @@ /*!

// some of these tests were sourced from mout/mout
describe('mergeDeep', function () {

@@ -20,5 +22,5 @@ it('should merge object properties without affecting any object', function () {

var actual = {a:4, b:1, c:2, d:5};
var actual = {a: 4, b: 1, c: 2, d: 5 };
merge(obj1, obj2, obj3).should.eql(actual);
merge({}, obj1, obj2, obj3).should.eql(actual);
actual.should.not.eql(obj1);

@@ -31,5 +33,5 @@ actual.should.not.eql(obj2);

var obj1 = {a: {b: 1, c: 1, d: {e: 1, f: 1}}};
var obj2 = {a: {b: 2, d : {f : 'yeah'} }};
var obj2 = {a: {b: 2, d : {f : 'f'} }};
merge(obj1, obj2).should.eql({a: {b: 2, c: 1, d: {e: 1, f: 'yeah'} }});
merge(obj1, obj2).should.eql({a: {b: 2, c: 1, d: {e: 1, f: 'f'} }});
});

@@ -41,3 +43,3 @@

var actual = merge(obj1, obj2);
var actual = merge({}, obj1, obj2);
actual.should.eql({a:{b:1, c:2}});

@@ -59,5 +61,3 @@ actual.a.should.not.eql(obj1.a);

it('should copy source properties', function() {
var fixture = { test: true };
var actual = merge(fixture);
actual.test.should.be.true;
merge({ test: true }).test.should.be.true;
});

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