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

Function outOf

__tests__/require-default.test.ts:184–192  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

182
183/** The call and instantiation edges out of a file's nodes, as `kind target-file:target-name`. */
184const outOf = (file: string) =>
185 cg
186 .getOutgoingEdgesFrom(cg.getNodesInFile(file).map((n) => n.id))
187 .filter((e) => e.kind === 'calls' || e.kind === 'instantiates')
188 .map((e) => {
189 const target = cg.getNode(e.target)!;
190 return `${e.kind} ${target.filePath}:${target.name}`;
191 })
192 .sort();
193
194describe('`require(…).default` of an ES module', () => {
195 it('is the module’s default export, as `.default` and as `{ default: X }`', () => {

Callers 1

Calls 4

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

Tested by

no test coverage detected