Skip to content

Commit

Permalink
PR comments - remove frivolous comments, use Array.from(target)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Trinidad committed Jun 13, 2019
1 parent a65fd9e commit dac812e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/jest-snapshot/src/utils.ts
Expand Up @@ -179,17 +179,14 @@ export const saveSnapshotFile = (
};

const deepMergeArray = (target: Array<any>, source: Array<any>) => {
// 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
Expand Down

0 comments on commit dac812e

Please sign in to comment.