Files
klz-cables.com/.pnpm-store/v10/files/63/05de951beeeeea177dd669e9b6e5d499680a940307d88c89682be942fe1652662c2b1cd5d0bce28e6d7acefb28c2b03e9e879fd5f176770292429034c41290
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

39 lines
849 B
Plaintext

'use client';
export const createRelationMap = ({
hasMany,
relationTo,
value
}) => {
const relationMap = relationTo.reduce((map, current) => {
return {
...map,
[current]: []
};
}, {});
if (value === null) {
return relationMap;
}
if (value) {
const add = (relation, id) => {
if ((typeof id === 'string' || typeof id === 'number') && typeof relation === 'string') {
if (relationMap[relation]) {
relationMap[relation].push(id);
} else {
relationMap[relation] = [id];
}
}
};
if (hasMany === true) {
value.forEach(val => {
if (val) {
add(val.relationTo, val.value);
}
});
} else {
add(value.relationTo, value.value);
}
}
return relationMap;
};
//# sourceMappingURL=createRelationMap.js.map