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

Function parameterPattern

src/resolution/frameworks/react.ts:1697–1704  ·  view source on GitHub ↗

A parameter's binding pattern, without its type or default: `{ default: Page }` of `{ default: Page }: Module`.

(param: string)

Source from the content-addressed store, hash-verified

1695
1696/** A parameter's binding pattern, without its type or default: `{ default: Page }` of `{ default: Page }: Module`. */
1697function parameterPattern(param: string): string {
1698 param = param.replace(/^\.\.\.\s*/, '');
1699 if (param.startsWith('{') || param.startsWith('[')) {
1700 const close = matchBracket(param, 0);
1701 return close < 0 ? '' : param.slice(0, close + 1);
1702 }
1703 return /^[A-Za-z_$][\w$]*/.exec(param)?.[0] ?? '';
1704}
1705
1706/**
1707 * The value a function body hands back from its first top-level `return`,

Callers 1

loaderValueFunction · 0.85

Calls 2

matchBracketFunction · 0.90
execMethod · 0.65

Tested by

no test coverage detected