Skip to content

Commit

Permalink
fix(shared): Fix merge undefined is not work (#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang authored Sep 4, 2020
1 parent 5dde72a commit 40489ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/shared/src/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function propertyIsUnsafe(target, key) {
}

function mergeObject(target: any, source: any, options: Options) {
const destination = options.assign ? target : {}
const destination = options.assign ? target || {} : {}
if (!options.isMergeableObject(target)) return target
if (!options.assign) {
getKeys(target).forEach(function(key) {
Expand All @@ -100,6 +100,9 @@ function mergeObject(target: any, source: any, options: Options) {
if (propertyIsUnsafe(target, key)) {
return
}
if (!target[key]) {
destination[key] = source[key]
}
if (
propertyIsOnObject(target, key) &&
options.isMergeableObject(source[key])
Expand Down

0 comments on commit 40489ac

Please sign in to comment.