Files
klz-cables.com/.pnpm-store/v10/files/63/6f7a56e860dbf8ec5a3f5985d514781724cf3b55f3003211232eecf64a83d32b40446c20713220fb3994774b2332a2c6d972b3dfc8b4af164571e017a7a23d
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.0 KiB
Plaintext

import { isSafeFromPollution } from './utilities.js';
export const processNested = function(data) {
if (!data || data.length < 1) {
return Object.create(null);
}
const d = Object.create(null), keys = Object.keys(data);
for(let i = 0; i < keys.length; i++){
const key = keys[i], keyParts = key?.replace(new RegExp(/\[/g), '.').replace(new RegExp(/\]/g), '').split('.'), value = data[key];
let current = d;
for(let index = 0; index < keyParts.length; index++){
const k = keyParts[index];
// Ensure we don't allow prototype pollution
if (!isSafeFromPollution(current, k)) {
continue;
}
if (index >= keyParts.length - 1) {
current[k] = value;
} else {
if (!current[k]) {
current[k] = !keyParts[index + 1] ? [] : Object.create(null);
}
current = current[k];
}
}
}
return d;
};
//# sourceMappingURL=processNested.js.map