From e9e06df923c226a8f15ebf111fb5fdbf740a6beb Mon Sep 17 00:00:00 2001 From: xiaoluoHe Date: Tue, 20 Aug 2024 13:22:56 +0800 Subject: [PATCH 1/2] fix: merge error for invalid value --- packages/vutils/src/common/merge.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vutils/src/common/merge.ts b/packages/vutils/src/common/merge.ts index 3f39a29..615de07 100644 --- a/packages/vutils/src/common/merge.ts +++ b/packages/vutils/src/common/merge.ts @@ -70,7 +70,7 @@ function baseMergeDeep( // } // 不考虑 argument 类型 else if (isPlainObject(srcValue)) { - newValue = objValue; + newValue = objValue ?? {}; // 不考虑 prototype 的额外处理 if (typeof objValue === 'function' || typeof objValue !== 'object') { newValue = {}; From 11ed0daab5d3f1dac7c4792a234309d867d3fc8a Mon Sep 17 00:00:00 2001 From: xiaoluoHe Date: Tue, 20 Aug 2024 13:24:08 +0800 Subject: [PATCH 2/2] docs: update changelog --- .../vutils/fix-merge-error_2024-08-20-05-23.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@visactor/vutils/fix-merge-error_2024-08-20-05-23.json diff --git a/common/changes/@visactor/vutils/fix-merge-error_2024-08-20-05-23.json b/common/changes/@visactor/vutils/fix-merge-error_2024-08-20-05-23.json new file mode 100644 index 0000000..743cf3a --- /dev/null +++ b/common/changes/@visactor/vutils/fix-merge-error_2024-08-20-05-23.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vutils", + "comment": "fix: merge error for invalid value", + "type": "none" + } + ], + "packageName": "@visactor/vutils" +} \ No newline at end of file