Files
klz-cables.com/.pnpm-store/v10/files/8e/962fe72bc514fd329493cf5ca936bd061071799cd8bf2083d24035c2d4cf69d1a8f3d2448be276566476ab51bf949c7b5e5abbb7890a784f0020677f3471fa
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

29 lines
1.3 KiB
Plaintext

/**
* Very simple, but fast deepMerge implementation. Only deepMerges objects, not arrays and clones everything.
* Do not use this if your object contains any complex objects like React Components, or if you would like to combine Arrays.
* If you only have simple objects and need a fast deepMerge, this is the function for you.
*
* obj2 takes precedence over obj1 - thus if obj2 has a key that obj1 also has, obj2's value will be used.
*
* @param obj1 base object
* @param obj2 object to merge "into" obj1
*/ export function deepMergeSimple(obj1, obj2) {
const output = {
...obj1
};
for(const key in obj2){
if (Object.prototype.hasOwnProperty.call(obj2, key)) {
// @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
if (typeof obj2[key] === 'object' && !Array.isArray(obj2[key]) && obj1[key]) {
// @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
output[key] = deepMergeSimple(obj1[key], obj2[key]);
} else {
// @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
output[key] = obj2[key];
}
}
}
return output;
}
//# sourceMappingURL=deepMergeSimple.js.map