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

Function parseGraphqlName

src/resolution/frameworks/nestjs.ts:711–717  ·  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

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

Callers 1

extractFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected