/** * 检查值是否为空 */ export function isEmpty(value: any): boolean { return value === null || value === undefined || value === ''; } /** * 深度合并对象 */ export function deepMerge(target: T, source: Partial): T { if (!target || !source) return target; const result = { ...target }; for (const key in source) { const sourceValue = source[key]; const targetValue = result[key]; if (sourceValue !== undefined) { if (typeof sourceValue === 'object' && sourceValue !== null && typeof targetValue === 'object' && targetValue !== null && !Array.isArray(sourceValue) && !Array.isArray(targetValue)) { (result as any)[key] = deepMerge(targetValue, sourceValue); } else { (result as any)[key] = sourceValue; } } } return result; }