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

Function fnRefsFrom

__tests__/function-ref-project-imports.test.ts:41–51  ·  view source on GitHub ↗

` -> : ` for each function-as-value edge leaving `file`.

(cg: CodeGraph, file: string)

Source from the content-addressed store, hash-verified

39
40/** `<value name> -> <target file>:<target qualified name>` for each function-as-value edge leaving `file`. */
41function fnRefsFrom(cg: CodeGraph, file: string): string[] {
42 const ids = cg.getNodesInFile(file).map((n) => n.id);
43 return [...new Set(cg
44 .getOutgoingEdgesFrom(ids)
45 .filter((e) => e.metadata?.fnRef === true)
46 .map((e) => {
47 const target = cg.getNode(e.target);
48 return `${String(e.metadata?.refName)} -> ${target?.filePath}:${target?.qualifiedName}`;
49 }))]
50 .sort();
51}
52
53const PACKAGE_JSON = JSON.stringify({ name: 'wiki', dependencies: { react: '^18.2.0', 'styled-components': '^6.1.0' } });
54const TSCONFIG = JSON.stringify({ compilerOptions: { baseUrl: '.', jsx: 'react-jsx' } });

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected