(target: any[] = [], source: any[] = [])
| 176 | } |
| 177 | |
| 178 | function deepMergeArray(target: any[] = [], source: any[] = []) { |
| 179 | const mergedOutput = Array.from(target) |
| 180 | |
| 181 | source.forEach((sourceElement, index) => { |
| 182 | const targetElement = mergedOutput[index] |
| 183 | |
| 184 | if (Array.isArray(target[index])) { |
| 185 | mergedOutput[index] = deepMergeArray(target[index], sourceElement) |
| 186 | } |
| 187 | else if (isObject(targetElement)) { |
| 188 | mergedOutput[index] = deepMergeSnapshot(target[index], sourceElement) |
| 189 | } |
| 190 | else { |
| 191 | // Source does not exist in target or target is primitive and cannot be deep merged |
| 192 | mergedOutput[index] = sourceElement |
| 193 | } |
| 194 | }) |
| 195 | |
| 196 | return mergedOutput |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Deep merge, but considers asymmetric matchers. Unlike base util's deep merge, |
no test coverage detected