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

Function goSplitArgs

src/resolution/callback-synthesizer.ts:1915–1926  ·  view source on GitHub ↗

Split a top-level comma list, respecting nested () [] {}.

(args: string)

Source from the content-addressed store, hash-verified

1913}
1914/** Split a top-level comma list, respecting nested () [] {}. */
1915function goSplitArgs(args: string): string[] {
1916 const out: string[] = [];
1917 let depth = 0, cur = '';
1918 for (const c of args) {
1919 if (c === '(' || c === '[' || c === '{') { depth++; cur += c; }
1920 else if (c === ')' || c === ']' || c === '}') { depth--; cur += c; }
1921 else if (c === ',' && depth === 0) { out.push(cur); cur = ''; }
1922 else cur += c;
1923 }
1924 if (cur.trim()) out.push(cur);
1925 return out;
1926}
1927/** Tail ident of a handler arg: `gin.Logger()`→`Logger`, `mw`→`mw`; null for string paths / closures. */
1928function goHandlerIdent(expr: string): string | null {
1929 const cleaned = expr.trim().replace(/\(\s*\)$/, ''); // drop a trailing call ()

Callers 1

ginMiddlewareChainEdgesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected