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 3.0.1 to 3.0.2

20

index.js

@@ -10,10 +10,12 @@ /*!

var utils = require('./utils');
var union = require('arr-union');
var clone = require('clone-deep');
var typeOf = require('kind-of');
module.exports = function mergeDeep(orig, objects) {
if (!utils.isObject(orig) && !Array.isArray(orig)) {
if (!isObject(orig) && !Array.isArray(orig)) {
orig = {};
}
var target = utils.clone(orig);
var target = clone(orig);
var len = arguments.length;

@@ -25,3 +27,3 @@ var idx = 0;

if (utils.isObject(val) || Array.isArray(val)) {
if (isObject(val) || Array.isArray(val)) {
merge(target, val);

@@ -42,8 +44,8 @@ }

if (utils.isObject(newVal) && utils.isObject(oldVal)) {
if (isObject(newVal) && isObject(oldVal)) {
target[key] = merge(newVal, oldVal);
} else if (Array.isArray(newVal)) {
target[key] = utils.union([], newVal, oldVal);
target[key] = union([], newVal, oldVal);
} else {
target[key] = utils.clone(oldVal);
target[key] = clone(oldVal);
}

@@ -57,1 +59,5 @@ }

}
function isObject(val) {
return typeOf(val) === 'object' || typeOf(val) === 'function';
}
{
"name": "merge-deep",
"description": "Recursively merge values in a javascript object.",
"version": "3.0.1",
"version": "3.0.2",
"homepage": "https://github.com/jonschlinkert/merge-deep",

@@ -13,4 +13,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"files": [
"index.js",
"utils.js"
"index.js"
],

@@ -27,4 +26,3 @@ "main": "index.js",

"clone-deep": "^0.2.4",
"kind-of": "^3.0.2",
"lazy-cache": "^1.0.3"
"kind-of": "^3.0.2"
},

@@ -31,0 +29,0 @@ "devDependencies": {

@@ -1,5 +0,7 @@

# 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)
# merge-deep [![NPM version](https://img.shields.io/npm/v/merge-deep.svg?style=flat)](https://www.npmjs.com/package/merge-deep) [![NPM monthly downloads](https://img.shields.io/npm/dm/merge-deep.svg?style=flat)](https://npmjs.org/package/merge-deep) [![NPM total downloads](https://img.shields.io/npm/dt/merge-deep.svg?style=flat)](https://npmjs.org/package/merge-deep) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/merge-deep.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/merge-deep)
> Recursively merge values in a javascript object.
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Install

@@ -10,3 +12,3 @@

```sh
$ npm install merge-deep --save
$ npm install --save merge-deep
```

@@ -25,53 +27,68 @@

## Related projects
## About
You might also be interested in these projects:
<details>
<summary><strong>Contributing</strong></summary>
* [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)
* [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)
* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow)
* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep)
* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep)
* [omit-deep](https://www.npmjs.com/package/omit-deep): Recursively omit the specified key or keys from an object. | [homepage](https://github.com/jonschlinkert/omit-deep)
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
## Contributing
</details>
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/merge-deep/issues/new).
<details>
<summary><strong>Running Tests</strong></summary>
## Building docs
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
Generate readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm install verb && npm run docs
$ npm install && npm test
```
Or, if [verb](https://github.com/verbose/verb) is installed globally:
</details>
```sh
$ verb
```
<details>
<summary><strong>Building docs</strong></summary>
## Running tests
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
Install dev dependencies:
To generate the readme, run the following command:
```sh
$ npm install -d && npm test
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
## Author
</details>
### Related projects
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://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep)
* [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)
* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow)
* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep)
* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep)
* [omit-deep](https://www.npmjs.com/package/omit-deep): Recursively omit the specified key or keys from an object. | [homepage](https://github.com/jonschlinkert/omit-deep)
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 29 | [jonschlinkert](https://github.com/jonschlinkert) |
| 4 | [doowb](https://github.com/doowb) |
### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
## License
### License
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/merge-deep/blob/master/LICENSE).
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 13, 2016._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 11, 2018._

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