Files
klz-cables.com/.pnpm-store/v10/files/e7/6f553b1925c28217c6f1f387c426181edcfade290a9ef54084221576b441caf061a68bab0554c73f1e9aff742e0826243641434f8a98a8514a822efe2dbce2
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
928 B
Plaintext

export function combineWhereConstraints(constraints, as = 'and') {
if (constraints.length === 0) {
return {};
}
const reducedConstraints = constraints.reduce((acc, constraint)=>{
if (constraint && typeof constraint === 'object' && Object.keys(constraint).length > 0) {
if (as in constraint) {
// merge the objects under the shared key
acc[as] = [
...acc[as],
...constraint[as]
];
} else {
// the constraint does not share the key
acc[as]?.push(constraint);
}
}
return acc;
}, {
[as]: []
});
if (reducedConstraints[as]?.length === 0) {
// If there are no constraints, return an empty object
return {};
}
return reducedConstraints;
}
//# sourceMappingURL=combineWhereConstraints.js.map