(target: Array<any>, source: Array<any>)
| 89 | ['Any', 'Anything'].includes(input.constructor.name); |
| 90 | |
| 91 | const deepMergeArray = (target: Array<any>, source: Array<any>) => { |
| 92 | const mergedOutput = [...target]; |
| 93 | |
| 94 | for (const [index, sourceElement] of source.entries()) { |
| 95 | const targetElement = mergedOutput[index]; |
| 96 | |
| 97 | if (Array.isArray(target[index]) && Array.isArray(sourceElement)) { |
| 98 | mergedOutput[index] = deepMergeArray(target[index], sourceElement); |
| 99 | } else if (isObject(targetElement) && !isAnyOrAnything(sourceElement)) { |
| 100 | mergedOutput[index] = deepMerge(target[index], sourceElement); |
| 101 | } else { |
| 102 | // Source does not exist in target or target is primitive and cannot be deep merged |
| 103 | mergedOutput[index] = sourceElement; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | return mergedOutput; |
| 108 | }; |
| 109 | |
| 110 | // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types |
| 111 | export const deepMerge = (target: any, source: any): any => { |
no test coverage detected