mixin-deep
Advanced tools
Comparing version 1.1.0 to 1.1.1
36
index.js
@@ -6,10 +6,10 @@ 'use strict'; | ||
module.exports = function deepMixin(o, objects) { | ||
function mixinDeep(o, objects) { | ||
if (!isObject(o)) return {}; | ||
if (!isObject(objects)) return o; | ||
// don't slice args for v8 optimizations | ||
var len = arguments.length - 1; | ||
for (var i = 0; i < len; i++) { | ||
var obj = arguments[i + 1]; | ||
if (isObject(obj)) { | ||
@@ -19,12 +19,26 @@ forOwn(obj, copy, o); | ||
} | ||
return o; | ||
} | ||
function copy(value, key) { | ||
var obj = this[key]; | ||
if (isObject(value) && isObject(obj)) { | ||
deepMixin(obj, value); | ||
} else { | ||
this[key] = value; | ||
} | ||
/** | ||
* copy properties from the source object to the | ||
* target object. | ||
* | ||
* @param {*} `value` | ||
* @param {String} `key` | ||
*/ | ||
function copy(value, key) { | ||
var obj = this[key]; | ||
if (isObject(value) && isObject(obj)) { | ||
mixinDeep(obj, value); | ||
} else { | ||
this[key] = value; | ||
} | ||
return o; | ||
}; | ||
} | ||
/** | ||
* Expose `mixinDeep` | ||
*/ | ||
module.exports = mixinDeep; |
{ | ||
"name": "mixin-deep", | ||
"description": "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"homepage": "https://github.com/jonschlinkert/mixin-deep", | ||
"author": { | ||
"name": "Jon Schlinkert", | ||
"url": "https://github.com/jonschlinkert" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/jonschlinkert/mixin-deep.git" | ||
}, | ||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"repository": "jonschlinkert/mixin-deep", | ||
"bugs": { | ||
"url": "https://github.com/jonschlinkert/mixin-deep/issues" | ||
}, | ||
"license": { | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/mixin-deep/blob/master/LICENSE" | ||
}, | ||
"license": "MIT", | ||
"files": [ | ||
@@ -33,3 +24,3 @@ "index.js" | ||
"for-own": "^0.1.3", | ||
"is-plain-object": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.0.tgz" | ||
"is-plain-object": "^2.0.0" | ||
}, | ||
@@ -41,2 +32,3 @@ "devDependencies": { | ||
"keywords": [ | ||
"deep", | ||
"extend", | ||
@@ -43,0 +35,0 @@ "key", |
@@ -5,8 +5,16 @@ # mixin-deep [![NPM version](https://badge.fury.io/js/mixin-deep.svg)](http://badge.fury.io/js/mixin-deep) | ||
## Install with [npm](npmjs.org) | ||
## Install | ||
```bash | ||
npm i mixin-deep --save | ||
Install with [npm](https://www.npmjs.com/) | ||
```sh | ||
$ npm i mixin-deep --save | ||
``` | ||
Install with [bower](http://bower.io/) | ||
```sh | ||
$ bower install mixin-deep --save | ||
``` | ||
## Usage | ||
@@ -23,5 +31,7 @@ | ||
* [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object. If a callback… [more](https://github.com/jonschlinkert/assign-deep) | ||
* [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object. | ||
* [defaults-deep](https://github.com/jonschlinkert/defaults-deep): Like `extend` but recursively copies only the missing properties/values to the target object. | ||
* [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | ||
* [merge-deep](https://github.com/jonschlinkert/merge-deep): Recursively merge values in a javascript object. | ||
* [omit-deep](https://github.com/jonschlinkert/omit-deep): Recursively omit the specified key or keys from an object. | ||
@@ -32,4 +42,4 @@ ## Running tests | ||
```bash | ||
npm i -d && npm test | ||
```sh | ||
$ npm i -d && npm test | ||
``` | ||
@@ -39,3 +49,3 @@ | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/mixin-deep/issues) | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/mixin-deep/issues/new) | ||
@@ -51,3 +61,3 @@ ## Author | ||
Copyright (c) 2015 Jon Schlinkert | ||
Copyright © 2015 Jon Schlinkert | ||
Released under the MIT license. | ||
@@ -57,4 +67,2 @@ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 29, 2015._ | ||
<!-- reflinks generated by verb-reflinks plugin --> | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 28, 2015._ |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
4591
35
63
0
1
+ Addedis-plain-object@2.0.4(transitive)
+ Addedisobject@3.0.1(transitive)
Updatedis-plain-object@^2.0.0