mixin-deep 1.1.3 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/README.md +45 -27
- package/index.js +15 -0
- package/package.json +22 -10
package/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2014-2015, Jon Schlinkert.
|
3
|
+
Copyright (c) 2014-2015, 2017, Jon Schlinkert.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
@@ -1,19 +1,15 @@
|
|
1
|
-
# mixin-deep [![NPM version](https://
|
1
|
+
# mixin-deep [![NPM version](https://img.shields.io/npm/v/mixin-deep.svg?style=flat)](https://www.npmjs.com/package/mixin-deep) [![NPM monthly downloads](https://img.shields.io/npm/dm/mixin-deep.svg?style=flat)](https://npmjs.org/package/mixin-deep) [![NPM total downloads](https://img.shields.io/npm/dt/mixin-deep.svg?style=flat)](https://npmjs.org/package/mixin-deep) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/mixin-deep.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/mixin-deep)
|
2
2
|
|
3
3
|
> Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Install with [npm](https://www.npmjs.com/)
|
5
|
+
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
8
6
|
|
9
|
-
|
10
|
-
$ npm i mixin-deep --save
|
11
|
-
```
|
7
|
+
## Install
|
12
8
|
|
13
|
-
Install with [
|
9
|
+
Install with [npm](https://www.npmjs.com/):
|
14
10
|
|
15
11
|
```sh
|
16
|
-
$
|
12
|
+
$ npm install --save mixin-deep
|
17
13
|
```
|
18
14
|
|
19
15
|
## Usage
|
@@ -25,38 +21,60 @@ mixinDeep({a: {aa: 'aa'}}, {a: {bb: 'bb'}}, {a: {cc: 'cc'}});
|
|
25
21
|
//=> { a: { aa: 'aa', bb: 'bb', cc: 'cc' } }
|
26
22
|
```
|
27
23
|
|
28
|
-
##
|
24
|
+
## About
|
25
|
+
|
26
|
+
<details>
|
27
|
+
<summary><strong>Contributing</strong></summary>
|
29
28
|
|
30
|
-
|
31
|
-
* [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)
|
32
|
-
* [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)
|
33
|
-
* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep)
|
34
|
-
* [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)
|
29
|
+
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
35
30
|
|
36
|
-
|
31
|
+
</details>
|
37
32
|
|
38
|
-
|
33
|
+
<details>
|
34
|
+
<summary><strong>Running Tests</strong></summary>
|
35
|
+
|
36
|
+
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:
|
39
37
|
|
40
38
|
```sh
|
41
|
-
$ npm
|
39
|
+
$ npm install && npm test
|
42
40
|
```
|
43
41
|
|
44
|
-
|
42
|
+
</details>
|
43
|
+
<details>
|
44
|
+
<summary><strong>Building docs</strong></summary>
|
45
|
+
|
46
|
+
_(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.)_
|
47
|
+
|
48
|
+
To generate the readme, run the following command:
|
49
|
+
|
50
|
+
```sh
|
51
|
+
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
52
|
+
```
|
53
|
+
|
54
|
+
</details>
|
55
|
+
|
56
|
+
### Related projects
|
57
|
+
|
58
|
+
You might also be interested in these projects:
|
45
59
|
|
46
|
-
|
60
|
+
* [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 "Like `extend` but recursively copies only the missing properties/values to the target object.")
|
61
|
+
* [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 "Extend an object with the properties of additional objects. node.js/javascript util.")
|
62
|
+
* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.")
|
63
|
+
* [mixin-object](https://www.npmjs.com/package/mixin-object): Mixin the own and inherited properties of other objects onto the first object. Pass an… [more](https://github.com/jonschlinkert/mixin-object) | [homepage](https://github.com/jonschlinkert/mixin-object "Mixin the own and inherited properties of other objects onto the first object. Pass an empty object as the first arg to shallow clone.")
|
47
64
|
|
48
|
-
|
65
|
+
### Author
|
49
66
|
|
50
67
|
**Jon Schlinkert**
|
51
68
|
|
52
|
-
|
53
|
-
|
69
|
+
* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)
|
70
|
+
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
71
|
+
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
54
72
|
|
55
|
-
|
73
|
+
### License
|
56
74
|
|
57
|
-
Copyright ©
|
58
|
-
Released under the MIT
|
75
|
+
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
76
|
+
Released under the [MIT License](LICENSE).
|
59
77
|
|
60
78
|
***
|
61
79
|
|
62
|
-
_This file was generated by [verb-
|
80
|
+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 09, 2017._
|
package/index.js
CHANGED
@@ -23,6 +23,10 @@ function mixinDeep(target, objects) {
|
|
23
23
|
*/
|
24
24
|
|
25
25
|
function copy(val, key) {
|
26
|
+
if (!isValidKey(key)) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
|
26
30
|
var obj = this[key];
|
27
31
|
if (isObject(val) && isObject(obj)) {
|
28
32
|
mixinDeep(obj, val);
|
@@ -42,6 +46,17 @@ function isObject(val) {
|
|
42
46
|
return isExtendable(val) && !Array.isArray(val);
|
43
47
|
}
|
44
48
|
|
49
|
+
/**
|
50
|
+
* Returns true if `key` is a valid key to use when extending objects.
|
51
|
+
*
|
52
|
+
* @param {String} `key`
|
53
|
+
* @return {Boolean}
|
54
|
+
*/
|
55
|
+
|
56
|
+
function isValidKey(key) {
|
57
|
+
return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
|
58
|
+
};
|
59
|
+
|
45
60
|
/**
|
46
61
|
* Expose `mixinDeep`
|
47
62
|
*/
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "mixin-deep",
|
3
3
|
"description": "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.",
|
4
|
-
"version": "1.
|
4
|
+
"version": "1.3.2",
|
5
5
|
"homepage": "https://github.com/jonschlinkert/mixin-deep",
|
6
6
|
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
7
7
|
"repository": "jonschlinkert/mixin-deep",
|
@@ -20,12 +20,13 @@
|
|
20
20
|
"test": "mocha"
|
21
21
|
},
|
22
22
|
"dependencies": {
|
23
|
-
"for-in": "^0.
|
24
|
-
"is-extendable": "^0.1
|
23
|
+
"for-in": "^1.0.2",
|
24
|
+
"is-extendable": "^1.0.1"
|
25
25
|
},
|
26
26
|
"devDependencies": {
|
27
|
-
"
|
28
|
-
"
|
27
|
+
"gulp-format-md": "^1.0.0",
|
28
|
+
"mocha": "^3.5.3",
|
29
|
+
"should": "^13.1.3"
|
29
30
|
},
|
30
31
|
"keywords": [
|
31
32
|
"deep",
|
@@ -40,14 +41,25 @@
|
|
40
41
|
"util",
|
41
42
|
"values"
|
42
43
|
],
|
43
|
-
"
|
44
|
+
"verb": {
|
45
|
+
"toc": false,
|
46
|
+
"layout": "default",
|
47
|
+
"tasks": [
|
48
|
+
"readme"
|
49
|
+
],
|
50
|
+
"plugins": [
|
51
|
+
"gulp-format-md"
|
52
|
+
],
|
44
53
|
"related": {
|
45
54
|
"list": [
|
46
|
-
"
|
47
|
-
"merge-deep",
|
55
|
+
"defaults-deep",
|
48
56
|
"extend-shallow",
|
49
|
-
"
|
57
|
+
"merge-deep",
|
58
|
+
"mixin-object"
|
50
59
|
]
|
60
|
+
},
|
61
|
+
"lint": {
|
62
|
+
"reflinks": true
|
51
63
|
}
|
52
64
|
}
|
53
|
-
}
|
65
|
+
}
|