From 4e296346765a86dd51a0ff6758c65082584595d1 Mon Sep 17 00:00:00 2001 From: Tim Trinidad Date: Tue, 11 Jun 2019 15:06:12 -0400 Subject: [PATCH] use isObject --- packages/jest-snapshot/src/utils.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/jest-snapshot/src/utils.ts b/packages/jest-snapshot/src/utils.ts index b3500a59bd47..184e24f737f0 100644 --- a/packages/jest-snapshot/src/utils.ts +++ b/packages/jest-snapshot/src/utils.ts @@ -184,12 +184,11 @@ const deepMergeArray = (target: Array, source: Array) => { 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 {