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

merge-deep

Package Overview
Dependencies
Maintainers
2
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 2.0.2 to 3.0.0

32

index.js

@@ -13,9 +13,14 @@ /*!

module.exports = function mergeDeep(orig, objects) {
if (!utils.isObject(orig)) orig = {};
if (!utils.isObject(orig) && !Array.isArray(orig)) {
orig = {};
}
var target = utils.clone(orig);
var len = arguments.length;
var target = utils.clone(orig);
var idx = 0;
for (var i = 1; i < len; i++) {
var val = arguments[i];
if (utils.isObject(val)) {
while (++idx < len) {
var val = arguments[idx];
if (utils.isObject(val) || Array.isArray(val)) {
merge(target, val);

@@ -29,8 +34,15 @@ }

for (var key in obj) {
if (!hasOwn(obj, key)) continue;
var val = obj[key];
if (utils.isObject(target[key])) {
target[key] = merge(target[key] || {}, val);
if (!hasOwn(obj, key)) {
continue;
}
var oldVal = obj[key];
var newVal = target[key];
if (utils.isObject(newVal) && utils.isObject(oldVal)) {
target[key] = merge(newVal, oldVal);
} else if (Array.isArray(newVal)) {
target[key] = utils.union([], newVal, oldVal);
} else {
target[key] = utils.clone(val);
target[key] = utils.clone(oldVal);
}

@@ -37,0 +49,0 @@ }

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

@@ -24,9 +24,10 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"dependencies": {
"arr-union": "^3.1.0",
"clone-deep": "^0.2.4",
"is-extendable": "^0.1.1",
"kind-of": "^3.0.2",
"lazy-cache": "^1.0.3"
},
"devDependencies": {
"mocha": "*",
"should": "*"
"gulp-format-md": "^0.1.7",
"mocha": "^2.4.5"
},

@@ -55,2 +56,11 @@ "keywords": [

"verb": {
"run": true,
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {

@@ -66,6 +76,9 @@ "list": [

},
"plugins": [
"gulp-format-md"
]
"reflinks": [
"verb"
],
"lint": {
"reflinks": true
}
}
}

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

# merge-deep [![NPM version](https://img.shields.io/npm/v/merge-deep.svg)](https://www.npmjs.com/package/merge-deep) [![Build Status](https://img.shields.io/travis/jonschlinkert/merge-deep.svg)](https://travis-ci.org/jonschlinkert/merge-deep)
# merge-deep [![NPM version](https://img.shields.io/npm/v/merge-deep.svg?style=flat)](https://www.npmjs.com/package/merge-deep) [![NPM downloads](https://img.shields.io/npm/dm/merge-deep.svg?style=flat)](https://npmjs.org/package/merge-deep) [![Build Status](https://img.shields.io/travis/jonschlinkert/merge-deep.svg?style=flat)](https://travis-ci.org/jonschlinkert/merge-deep)
> Recursively merge values in a javascript object.
Based on [mout's](https://github.com/mout/mout) implementation of merge
## Install
Install with [npm](https://www.npmjs.com/)
Install with [npm](https://www.npmjs.com/):
```sh
$ npm i merge-deep --save
$ npm install merge-deep --save
```
Based on [mout's](https://github.com/mout/mout) implementation of merge
## Usage

@@ -26,2 +26,4 @@

You might also be interested in these projects:
* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://www.npmjs.com/package/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep)

@@ -34,2 +36,20 @@ * [defaults-deep](https://www.npmjs.com/package/defaults-deep): Like `extend` but recursively copies only the missing properties/values to the target object. | [homepage](https://github.com/jonschlinkert/defaults-deep)

## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/merge-deep/issues/new).
## Building docs
Generate readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm install verb && npm run docs
```
Or, if [verb](https://github.com/verbose/verb) is installed globally:
```sh
$ verb
```
## Running tests

@@ -40,9 +60,5 @@

```sh
$ npm i -d && npm test
$ npm install -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/merge-deep/issues/new).
## Author

@@ -57,7 +73,7 @@

Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/merge-deep/blob/master/LICENSE).
***
_This file was generated by [verb](https://github.com/verbose/verb) on December 23, 2015._
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 13, 2016._

@@ -11,6 +11,11 @@ 'use strict';

require('arr-union', 'union');
require('clone-deep', 'clone');
require('is-extendable', 'isObject');
require('kind-of', 'typeOf');
require = fn;
utils.isObject = function(val) {
return utils.typeOf(val) === 'object' || utils.typeOf(val) === 'function';
};
/**

@@ -21,1 +26,2 @@ * Expose `utils` modules

module.exports = utils;

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