From dac812e8fe2023efdbd0727b53cefa3fe8dff425 Mon Sep 17 00:00:00 2001 From: Tim Trinidad Date: Thu, 13 Jun 2019 11:20:25 -0400 Subject: [PATCH] PR comments - remove frivolous comments, use Array.from(target) --- packages/jest-snapshot/src/utils.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/jest-snapshot/src/utils.ts b/packages/jest-snapshot/src/utils.ts index b68aa9a5c863..1f45a981589b 100644 --- a/packages/jest-snapshot/src/utils.ts +++ b/packages/jest-snapshot/src/utils.ts @@ -179,17 +179,14 @@ export const saveSnapshotFile = ( }; const deepMergeArray = (target: Array, source: Array) => { - // Clone target - const mergedOutput = target.slice(); + const mergedOutput = Array.from(target) source.forEach((sourceElement, index) => { const targetElement = mergedOutput[index]; if (Array.isArray(target[index])) { - // Target is an array mergedOutput[index] = deepMergeArray(target[index], sourceElement); } else if (isObject(targetElement)) { - // Target is a (non-array) object - recursively merge mergedOutput[index] = deepMerge(target[index], sourceElement); } else { // Source does not exist in target or target is primitive and cannot be deep merged