Skip to content

Commit

Permalink
Revert "Manually rolling back #167"
Browse files Browse the repository at this point in the history
This reverts commit 5506735.
  • Loading branch information
Josh Duff committed Oct 21, 2019
1 parent 68ccfb2 commit 2a23592
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ function mergeObject(target, source, options) {
}

function deepmerge(target, source, options) {
options = options || {}
options.arrayMerge = options.arrayMerge || defaultArrayMerge
options.isMergeableObject = options.isMergeableObject || defaultIsMergeableObject
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
// implementations can use it. The caller may not replace it.
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified
options = Object.assign({
arrayMerge: defaultArrayMerge,
isMergeableObject: defaultIsMergeableObject
}, options, {
cloneUnlessOtherwiseSpecified: cloneUnlessOtherwiseSpecified
})

var sourceIsArray = Array.isArray(source)
var targetIsArray = Array.isArray(target)
Expand Down
9 changes: 9 additions & 0 deletions test/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,3 +637,12 @@ test('copy symbol keys in target that do exist on the target', function(t) {
t.equal(res[mySymbol], 'value1')
t.end()
})

test('should not mutate options', function(t) {
var options = {};

merge({}, {}, options);

t.deepEqual(options, {});
t.end();
})

0 comments on commit 2a23592

Please sign in to comment.