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

Function aliasTargetName

src/resolution/alias-binding.ts:46–65  ·  view source on GitHub ↗
(
  signature: string | undefined | null,
  memberName: string | null
)

Source from the content-addressed store, hash-verified

44 * (`= { run: impl }` for `api.run()`), including ES shorthand (`= { impl }`).
45 */
46export function aliasTargetName(
47 signature: string | undefined | null,
48 memberName: string | null
49): string | null {
50 if (!signature) return null;
51 const initializer = signature.trim();
52
53 if (memberName) {
54 const key = escapeRegExp(memberName);
55 const explicit = new RegExp(`[{,]\\s*${key}\\s*:\\s*([A-Za-z_$][\\w$]*)\\s*[,}]`).exec(initializer);
56 if (explicit) return explicit[1]!;
57 // `{ impl }` — shorthand binds the property to the same-named symbol.
58 const shorthand = new RegExp(`[{,]\\s*(${key})\\s*[,}]`).exec(initializer);
59 if (shorthand) return shorthand[1]!;
60 return null;
61 }
62
63 const bare = BARE_ALIAS_RE.exec(initializer);
64 return bare ? bare[1]! : null;
65}
66
67/**
68 * The callable an alias binding forwards to.

Callers 1

resolveAliasBindingFunction · 0.85

Calls 2

escapeRegExpFunction · 0.70
execMethod · 0.65

Tested by

no test coverage detected