MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / methodsOf

Function methodsOf

__tests__/resolution.test.ts:1793–1805  ·  view source on GitHub ↗
(typeName: string, file: string)

Source from the content-addressed store, hash-verified

1791 cg = await CodeGraph.init(tempDir, { index: true });
1792
1793 const methodsOf = (typeName: string, file: string): string[] => {
1794 const node = cg
1795 .getNodesByKind('struct')
1796 .find((n) => n.name === typeName && n.filePath.replace(/\\/g, '/') === file);
1797 expect(node, `${typeName} @ ${file}`).toBeDefined();
1798 return cg
1799 .getOutgoingEdges(node!.id)
1800 .filter((e) => e.kind === 'contains')
1801 .map((e) => cg.getNode(e.target))
1802 .filter((n) => !!n && n.kind === 'method')
1803 .map((n) => n!.name)
1804 .sort();
1805 };
1806
1807 // Cross-file (non-generic) methods now attach to their struct.
1808 expect(methodsOf('Box', 'box.go')).toEqual(['Get', 'Set']);

Callers 1

resolution.test.tsFile · 0.70

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByKindMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected