(target: any, source: any)
| 109 | |
| 110 | // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types |
| 111 | export const deepMerge = (target: any, source: any): any => { |
| 112 | if (isObject(target) && isObject(source)) { |
| 113 | const mergedOutput = {...target}; |
| 114 | |
| 115 | for (const key of Object.keys(source)) { |
| 116 | if (isObject(source[key]) && !source[key].$$typeof) { |
| 117 | if (key in target) { |
| 118 | mergedOutput[key] = deepMerge(target[key], source[key]); |
| 119 | } else { |
| 120 | Object.assign(mergedOutput, {[key]: source[key]}); |
| 121 | } |
| 122 | } else if (Array.isArray(source[key])) { |
| 123 | mergedOutput[key] = deepMergeArray(target[key], source[key]); |
| 124 | } else { |
| 125 | Object.assign(mergedOutput, {[key]: source[key]}); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | return mergedOutput; |
| 130 | } else if (Array.isArray(target) && Array.isArray(source)) { |
| 131 | return deepMergeArray(target, source); |
| 132 | } |
| 133 | |
| 134 | return target; |
| 135 | }; |
| 136 | |
| 137 | const indent = ( |
| 138 | snapshot: string, |
no test coverage detected