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

Function resolveServiceMethod

src/resolution/frameworks/express.ts:739–755  ·  view source on GitHub ↗

* Resolve service/helper method using name-based lookup

(
  serviceName: string,
  method: string,
  context: ResolutionContext
)

Source from the content-addressed store, hash-verified

737 * Resolve service/helper method using name-based lookup
738 */
739function resolveServiceMethod(
740 serviceName: string,
741 method: string,
742 context: ResolutionContext
743): string | null {
744 // Look for the method in files matching the service name
745 const methodCandidates = context.getNodesByName(method);
746 const stripped = serviceName.replace(/(Service|Helper|Utils?)$/i, '').toLowerCase();
747 const methodNodes = methodCandidates.filter(
748 (n) => (n.kind === 'method' || n.kind === 'function') &&
749 n.filePath.toLowerCase().includes(stripped)
750 );
751
752 if (methodNodes.length > 0) return methodNodes[0]!.id;
753
754 return null;
755}
756
757/**
758 * Detect language from file extension

Callers 1

resolveFunction · 0.85

Calls 1

getNodesByNameMethod · 0.65

Tested by

no test coverage detected