2023-03-08 10:02:46 +08:00

15 lines
340 B
TypeScript

import { isObject } from '@/utils/is';
/**
* 深度合并
* @param src
* @param target
*/
export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
let key: string;
for (key in target) {
src[key] = isObject(src[key]) ? deepMerge(src[key], target[key]) : (src[key] = target[key]);
}
return src;
}