Skip to content

Commit

Permalink
Bug Fixes for deepMerge
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaming743 committed Jan 5, 2020
1 parent 9eec806 commit ab294ff
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@ export function filterNonNumber (array) {

export function deepMerge (target, merged) {
for (var key in merged) {
target[key] = target[key] && typeof target[key] === 'object' ?
deepMerge(target[key], merged[key]) : target[key] = merged[key]
if (target[key] && typeof target[key] === 'object') {
deepMerge(target[key], merged[key])

continue
}

if (typeof merged[key] === 'object') {
target[key] = deepClone(merged[key], true)

continue
}

target[key] = merged[key]
}

return target
Expand Down

0 comments on commit ab294ff

Please sign in to comment.