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
21 lines
561 B
Plaintext
21 lines
561 B
Plaintext
// Flatten rows to object with path keys
|
|
// for easier retrieval
|
|
export const createPathMap = (rows)=>{
|
|
let rowsByPath = {};
|
|
if (Array.isArray(rows)) {
|
|
rowsByPath = rows.reduce((res, row)=>{
|
|
const formattedRow = {
|
|
...row
|
|
};
|
|
delete formattedRow.path;
|
|
if (!res[row.path]) {
|
|
res[row.path] = [];
|
|
}
|
|
res[row.path].push(row);
|
|
return res;
|
|
}, {});
|
|
}
|
|
return rowsByPath;
|
|
};
|
|
|
|
//# sourceMappingURL=createRelationshipMap.js.map |