fix(deepMerge): 去掉合并错误的代码 (#2848)

This commit is contained in:
Kirk Lin 2023-06-10 17:19:18 +08:00 committed by GitHub
parent 9c43c74131
commit 1f287145f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,14 +52,6 @@ export function deepMerge<T extends object | null | undefined, U extends object
target: U,
mergeArrays: 'union' | 'intersection' | 'concat' | 'replace' = 'replace',
): T & U {
return mergeWith(cloneDeep(target), source, (objValue, srcValue) => {
if (isObject(objValue) && isObject(srcValue)) {
return mergeWith(cloneDeep(objValue), srcValue, (prevValue, nextValue) => {
// 如果是数组,合并数组(去重) If it is an array, merge the array (remove duplicates)
return isArray(prevValue) ? unionWith(prevValue, nextValue, isEqual) : undefined;
});
if (!target) {
return source as T & U;
}