Fix deepObjectMerge edge cases

pull/1017/head
Zef Hemel 2024-08-03 14:09:12 +02:00
parent 76dadb58b3
commit 102e6d10eb
1 changed files with 7 additions and 0 deletions

View File

@ -97,6 +97,13 @@ export function deepObjectMerge(a: any, b: any, reverseArrays = false): any {
if (typeof a !== typeof b) { if (typeof a !== typeof b) {
return b; return b;
} }
if (a === undefined || a === null) {
return b;
}
if (b === undefined || b === null) {
return a;
}
if (typeof a === "object") { if (typeof a === "object") {
if (Array.isArray(a) && Array.isArray(b)) { if (Array.isArray(a) && Array.isArray(b)) {
if (reverseArrays) { if (reverseArrays) {