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

Function splitArgs

src/ui-server/api/effects.ts:507–523  ·  view source on GitHub ↗

The abbreviated argument list split on its top-level commas.

(args: string)

Source from the content-addressed store, hash-verified

505
506/** The abbreviated argument list split on its top-level commas. */
507function splitArgs(args: string): string[] {
508 const out: string[] = [];
509 let depth = 0;
510 let current = '';
511 for (const ch of args) {
512 if (ch === '(' || ch === '[' || ch === '{') depth++;
513 else if (ch === ')' || ch === ']' || ch === '}') depth = Math.max(0, depth - 1);
514 if (ch === ',' && depth === 0) {
515 out.push(current.trim());
516 current = '';
517 continue;
518 }
519 current += ch;
520 }
521 if (current.trim()) out.push(current.trim());
522 return out;
523}
524
525function firstStatusToken(args: string, which: 'first' | 'last'): string {
526 const parts = splitArgs(args);

Callers 2

responseStatusFunction · 0.70
firstStatusTokenFunction · 0.70

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected