MCPcopy Create free account
hub / github.com/MigoXLab/coderio / extractComponentGroups

Function extractComponentGroups

src/nodes/process/structure/utils.ts:330–346  ·  view source on GitHub ↗
(node: Protocol)

Source from the content-addressed store, hash-verified

328 * @returns Map of componentName to array of instances
329 */
330export function extractComponentGroups(node: Protocol): Map<string, Protocol[]> {
331 if (!node || !node.children || node.children.length === 0) return new Map();
332 const componentGroups = new Map<string, Protocol[]>();
333 const validChildren = node.children.filter(c => c && c.data);
334
335 validChildren.forEach(child => {
336 const name = child.data.componentName;
337 if (name) {
338 if (!componentGroups.has(name)) {
339 componentGroups.set(name, []);
340 }
341 componentGroups.get(name)!.push(child);
342 }
343 });
344
345 return componentGroups;
346}
347
348/**
349 * Applies props and state to the protocol node

Callers 3

populateComponentPropsFunction · 0.85
traverseFunction · 0.85
traverseFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected