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

Function parameterNames

src/resolution/frameworks/elysia.ts:553–565  ·  view source on GitHub ↗

* The names a function argument's parameters bind, read from its parameter * list (`({ body, cookie: { auth } }, extra) =>` gives body, cookie, auth, * extra): every identifier in it, which can only over-read a destructured * key or a type. Empty for anything but an arrow or a `function`.

(text: string)

Source from the content-addressed store, hash-verified

551 * key or a type. Empty for anything but an arrow or a `function`.
552 */
553function parameterNames(text: string): Set<string> {
554 const single = /^\s*(?:async\s+)?([A-Za-z_$][\w$]*)\s*=>/.exec(text);
555 if (single) return new Set([single[1]!]);
556 const head = /^\s*(?:async\s*)?(?:function\b\s*\*?\s*[\w$]*\s*)?\(/.exec(text);
557 if (!head) return new Set();
558 let depth = 0;
559 let end = head[0].length - 1;
560 for (; end < text.length; end++) {
561 if (text[end] === '(') depth++;
562 else if (text[end] === ')' && --depth === 0) break;
563 }
564 return new Set(text.slice(head[0].length, end).match(/[A-Za-z_$][\w$]*/g) ?? []);
565}
566
567/**
568 * The references a route's handler makes. A named one (`getUser`,

Callers 1

routeRefsFunction · 0.70

Calls 1

execMethod · 0.65

Tested by

no test coverage detected