From 102e6d10eb50d1fb54305c1fee56f53fa889b255 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sat, 3 Aug 2024 14:09:12 +0200 Subject: [PATCH] Fix deepObjectMerge edge cases --- plug-api/lib/json.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plug-api/lib/json.ts b/plug-api/lib/json.ts index 80f6f86a..d3a096a6 100644 --- a/plug-api/lib/json.ts +++ b/plug-api/lib/json.ts @@ -97,6 +97,13 @@ export function deepObjectMerge(a: any, b: any, reverseArrays = false): any { if (typeof a !== typeof b) { return b; } + if (a === undefined || a === null) { + return b; + } + if (b === undefined || b === null) { + return a; + } + if (typeof a === "object") { if (Array.isArray(a) && Array.isArray(b)) { if (reverseArrays) {