MCPcopy
hub / github.com/vanila-io/wireflow / dataMapToData

Function dataMapToData

src/utils/dataMapToData.js:1–17  ·  view source on GitHub ↗
(dataMap)

Source from the content-addressed store, hash-verified

1export function dataMapToData(dataMap) {
2 const data = { nodes: [], edges: [], groups: [] };
3 if (dataMap) {
4 Object.keys(dataMap).forEach((id) => {
5 const item = dataMap[id];
6 if (item.type === 'node') {
7 data.nodes.push(item);
8 } else if (!!item.source && !!item.target) data.edges.push(item);
9 // just assuming that if an item is not node or edge but have x and y, it's a group
10 else if (!!item.x && !!item.y) {
11 data.groups.push(item);
12 }
13 });
14 }
15
16 return data;
17}

Callers 1

index.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected