mixin-deep 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -8
- package/index.js +11 -7
- package/package.json +5 -4
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# mixin-deep [](https://www.npmjs.com/package/mixin-deep) [](https://npmjs.org/package/mixin-deep) [](https://npmjs.org/package/mixin-deep) [](https://travis-ci.org/jonschlinkert/mixin-deep)
|
1
|
+
# mixin-deep [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [](https://www.npmjs.com/package/mixin-deep) [](https://npmjs.org/package/mixin-deep) [](https://npmjs.org/package/mixin-deep) [](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. No dependencies.
|
4
4
|
|
@@ -12,6 +12,10 @@ Install with [npm](https://www.npmjs.com/):
|
|
12
12
|
$ npm install --save mixin-deep
|
13
13
|
```
|
14
14
|
|
15
|
+
## Heads up!
|
16
|
+
|
17
|
+
[Please update](https://gist.github.com/jonschlinkert/9a62534c4f8bc76aee6058caa3f05fd6) to version 2.0.1 or later, a critical bug was fixed in that version.
|
18
|
+
|
15
19
|
## Usage
|
16
20
|
|
17
21
|
```js
|
@@ -65,24 +69,24 @@ You might also be interested in these projects:
|
|
65
69
|
|
66
70
|
### Contributors
|
67
71
|
|
68
|
-
| **Commits** | **Contributor** |
|
69
|
-
| --- | --- |
|
70
|
-
|
|
71
|
-
| 2
|
72
|
+
| **Commits** | **Contributor** |
|
73
|
+
| --- | --- |
|
74
|
+
| 28 | [jonschlinkert](https://github.com/jonschlinkert) |
|
75
|
+
| 2 | [doowb](https://github.com/doowb) |
|
72
76
|
|
73
77
|
### Author
|
74
78
|
|
75
79
|
**Jon Schlinkert**
|
76
80
|
|
77
|
-
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
78
81
|
* [GitHub Profile](https://github.com/jonschlinkert)
|
79
82
|
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
83
|
+
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
80
84
|
|
81
85
|
### License
|
82
86
|
|
83
|
-
Copyright ©
|
87
|
+
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
|
84
88
|
Released under the [MIT License](LICENSE).
|
85
89
|
|
86
90
|
***
|
87
91
|
|
88
|
-
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.
|
92
|
+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on June 19, 2019._
|
package/index.js
CHANGED
@@ -1,17 +1,25 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
const isObject = val => {
|
4
|
+
return typeof val === 'function' || (typeof val === 'object' && val !== null && !Array.isArray(val));
|
5
|
+
};
|
6
|
+
|
7
|
+
const isValidKey = key => {
|
8
|
+
return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
|
9
|
+
};
|
10
|
+
|
11
|
+
const mixinDeep = (target, ...rest) => {
|
4
12
|
for (let obj of rest) {
|
5
13
|
if (isObject(obj)) {
|
6
14
|
for (let key in obj) {
|
7
|
-
if (key
|
15
|
+
if (isValidKey(key)) {
|
8
16
|
mixin(target, obj[key], key);
|
9
17
|
}
|
10
18
|
}
|
11
19
|
}
|
12
20
|
}
|
13
21
|
return target;
|
14
|
-
}
|
22
|
+
};
|
15
23
|
|
16
24
|
function mixin(target, val, key) {
|
17
25
|
let obj = target[key];
|
@@ -22,10 +30,6 @@ function mixin(target, val, key) {
|
|
22
30
|
}
|
23
31
|
}
|
24
32
|
|
25
|
-
function isObject(val) {
|
26
|
-
return typeof val === 'function' || (typeof val === 'object' && val !== null && !Array.isArray(val));
|
27
|
-
}
|
28
|
-
|
29
33
|
/**
|
30
34
|
* Expose mixinDeep
|
31
35
|
* @type {Function}
|
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. No dependencies.",
|
4
|
-
"version": "2.0.
|
4
|
+
"version": "2.0.1",
|
5
5
|
"homepage": "https://github.com/jonschlinkert/mixin-deep",
|
6
6
|
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
7
7
|
"repository": "jonschlinkert/mixin-deep",
|
@@ -14,16 +14,17 @@
|
|
14
14
|
],
|
15
15
|
"main": "index.js",
|
16
16
|
"engines": {
|
17
|
-
"node": ">=
|
17
|
+
"node": ">=6"
|
18
18
|
},
|
19
19
|
"scripts": {
|
20
20
|
"test": "mocha"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
23
|
-
"gulp-format-md": "^
|
24
|
-
"mocha": "^
|
23
|
+
"gulp-format-md": "^2.0.0",
|
24
|
+
"mocha": "^6.1.4"
|
25
25
|
},
|
26
26
|
"keywords": [
|
27
|
+
"assign",
|
27
28
|
"deep",
|
28
29
|
"extend",
|
29
30
|
"key",
|