Files
klz-cables.com/.pnpm-store/v10/files/2e/65bebed88cf56153e98c85fea957e81fed74d9b2474089080f140b9f5110633fd6dc7995cf7259036b5103da5e54964ce3989041e2d87b16d010ef8ed8fab0
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

38 lines
1001 B
Plaintext

'use client';
export const separateRows = (path, fields) => {
const remainingFields = {};
const rows = Object.entries(fields).reduce((incomingRows, [fieldPath, field]) => {
const newRows = incomingRows;
if (fieldPath.indexOf(`${path}.`) === 0) {
const [rowIndex] = fieldPath.replace(`${path}.`, '').split('.');
if (!newRows[rowIndex]) {
newRows[rowIndex] = {};
}
newRows[rowIndex][fieldPath.replace(`${path}.${String(rowIndex)}.`, '')] = {
...field
};
} else {
remainingFields[fieldPath] = field;
}
return newRows;
}, []);
return {
remainingFields,
rows
};
};
export const flattenRows = (path, rows) => {
return rows.reduce((fields, row, i) => ({
...fields,
...Object.entries(row).reduce((subFields, [subPath, subField]) => {
return {
...subFields,
[`${path}.${i}.${subPath}`]: {
...subField
}
};
}, {})
}), {});
};
//# sourceMappingURL=rows.js.map