don't merge arrays in deepMerge by default
This commit is contained in:
parent
155de766e9
commit
da0918f49a
|
@ -333,13 +333,13 @@ Object.assign(debounce, {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function deepMerge(src, dst) {
|
function deepMerge(src, dst, mergeArrays) {
|
||||||
if (!src || typeof src !== 'object') {
|
if (!src || typeof src !== 'object') {
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
if (Array.isArray(src)) {
|
if (Array.isArray(src)) {
|
||||||
// using `Array` that belongs to this `window`; not using Array.from as it's slower
|
// using `Array` that belongs to this `window`; not using Array.from as it's slower
|
||||||
if (!dst) dst = Array.prototype.map.call(src, deepCopy);
|
if (!dst || !mergeArrays) dst = Array.prototype.map.call(src, deepCopy);
|
||||||
else for (const v of src) dst.push(deepMerge(v));
|
else for (const v of src) dst.push(deepMerge(v));
|
||||||
} else {
|
} else {
|
||||||
// using an explicit {} that belongs to this `window`
|
// using an explicit {} that belongs to this `window`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user