1 | var forOwn = require('./forOwn');
|
2 | var isPlainObject = require('../lang/isPlainObject');
|
3 |
|
4 | |
5 |
|
6 |
|
7 |
|
8 | function deepMixIn(target, objects) {
|
9 | var i = 0,
|
10 | n = arguments.length,
|
11 | obj;
|
12 |
|
13 | while(++i < n){
|
14 | obj = arguments[i];
|
15 | if (obj) {
|
16 | forOwn(obj, copyProp, target);
|
17 | }
|
18 | }
|
19 |
|
20 | return target;
|
21 | }
|
22 |
|
23 | function copyProp(val, key) {
|
24 | var existing = this[key];
|
25 | if (isPlainObject(val) && isPlainObject(existing)) {
|
26 | deepMixIn(existing, val);
|
27 | } else {
|
28 | this[key] = val;
|
29 | }
|
30 | }
|
31 |
|
32 | module.exports = deepMixIn;
|
33 |
|
34 |
|