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

Function arrowAt

src/resolution/frameworks/react.ts:1682–1694  ·  view source on GitHub ↗

Where the first `=>` outside brackets and strings is in `text`, or -1.

(text: string)

Source from the content-addressed store, hash-verified

1680
1681/** Where the first `=>` outside brackets and strings is in `text`, or -1. */
1682function arrowAt(text: string): number {
1683 for (let i = 0; i < text.length; i++) {
1684 const ch = text[i]!;
1685 if (ch === '"' || ch === "'" || ch === '`') {
1686 i = skipString(text, i);
1687 if (i < 0) return -1;
1688 } else if (ch === '{' || ch === '(' || ch === '[') {
1689 i = matchBracket(text, i);
1690 if (i < 0) return -1;
1691 } else if (ch === '=' && text[i + 1] === '>') return i;
1692 }
1693 return -1;
1694}
1695
1696/** A parameter's binding pattern, without its type or default: `{ default: Page }` of `{ default: Page }: Module`. */
1697function parameterPattern(param: string): string {

Callers 1

functionPartsFunction · 0.85

Calls 2

skipStringFunction · 0.90
matchBracketFunction · 0.90

Tested by

no test coverage detected