Skip to content

Commit

Permalink
Fix array clone case
Browse files Browse the repository at this point in the history
The issue was noted in #44 (comment)
  • Loading branch information
TehShrike committed Oct 14, 2016
1 parent c3d4464 commit 3014a8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function emptyTarget(val) {

function cloneIfNecessary(value, optionsArgument) {
var clone = optionsArgument && optionsArgument.clone === true
return (clone && isMergeableObject(value)) ? deepmerge(emptyTarget(value), value) : value
return (clone && isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, optionsArgument) : value
}

function defaultArrayMerge(target, source, optionsArgument) {
Expand Down Expand Up @@ -62,7 +62,7 @@ function deepmerge(target, source, optionsArgument) {
var arrayMerge = options.arrayMerge || defaultArrayMerge

if (array) {
return Array.isArray(target) ? arrayMerge(target, source, optionsArgument) : source.slice()
return Array.isArray(target) ? arrayMerge(target, source, optionsArgument) : cloneIfNecessary(source, optionsArgument)
} else {
return mergeObject(target, source, optionsArgument)
}
Expand Down

0 comments on commit 3014a8c

Please sign in to comment.