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

Function parseGraphqlName

src/resolution/frameworks/nestjs.ts:710–716  ·  view source on GitHub ↗

* GraphQL operation name. Prefers an explicit `{ name: 'x' }` or a leading * string literal (`@Query('users')`); otherwise the field name defaults to the * handler method name. Avoids mistaking a `description` string for the name.

(args: string, handler: string | null)

Source from the content-addressed store, hash-verified

708 * handler method name. Avoids mistaking a `description` string for the name.
709 */
710function parseGraphqlName(args: string, handler: string | null): string {
711 const named = args.match(/name\s*:\s*['"`]([^'"`]*)['"`]/);
712 if (named) return named[1]!;
713 const lead = args.match(/^\s*['"`]([^'"`]*)['"`]/);
714 if (lead) return lead[1]!;
715 return handler ?? '';
716}
717
718// ---------------------------------------------------------------------------
719// Path helpers

Callers 1

extractFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected