1 | import assignValue from './_assignValue.js';
|
2 | import baseAssignValue from './_baseAssignValue.js';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | function copyObject(source, props, object, customizer) {
|
15 | var isNew = !object;
|
16 | object || (object = {});
|
17 |
|
18 | var index = -1,
|
19 | length = props.length;
|
20 |
|
21 | while (++index < length) {
|
22 | var key = props[index];
|
23 |
|
24 | var newValue = customizer
|
25 | ? customizer(object[key], source[key], key, object, source)
|
26 | : undefined;
|
27 |
|
28 | if (newValue === undefined) {
|
29 | newValue = source[key];
|
30 | }
|
31 | if (isNew) {
|
32 | baseAssignValue(object, key, newValue);
|
33 | } else {
|
34 | assignValue(object, key, newValue);
|
35 | }
|
36 | }
|
37 | return object;
|
38 | }
|
39 |
|
40 | export default copyObject;
|