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

Function parameterPattern

src/resolution/frameworks/react.ts:1719–1726  ·  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

1717
1718/** A parameter's binding pattern, without its type or default: `{ default: Page }` of `{ default: Page }: Module`. */
1719function parameterPattern(param: string): string {
1720 param = param.replace(/^\.\.\.\s*/, '');
1721 if (param.startsWith('{') || param.startsWith('[')) {
1722 const close = matchBracket(param, 0);
1723 return close < 0 ? '' : param.slice(0, close + 1);
1724 }
1725 return /^[A-Za-z_$][\w$]*/.exec(param)?.[0] ?? '';
1726}
1727
1728/**
1729 * 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