Skip to content

Commit

Permalink
use isObject
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Trinidad committed Jun 11, 2019
1 parent c9d1aff commit 4e29634
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/jest-snapshot/src/utils.ts
Expand Up @@ -184,12 +184,11 @@ const deepMergeArray = (target: Array<any>, source: Array<any>) => {

source.forEach((sourceElement, index) => {
const targetElement = mergedOutput[index];
const targetElementType = typeof targetElement;

if (Array.isArray(target[index])) {
// Target is an array
mergedOutput[index] = deepMergeArray(target[index], sourceElement);
} else if (targetElementType === 'object') {
} else if (isObject(targetElement)) {
// Target is a (non-array) object - recursively merge
mergedOutput[index] = deepMerge(target[index], sourceElement);
} else {
Expand Down

0 comments on commit 4e29634

Please sign in to comment.