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

Function splitTopLevel

src/resolution/type-parameters.ts:322–337  ·  view source on GitHub ↗
(inner: string, angle: boolean)

Source from the content-addressed store, hash-verified

320}
321
322function splitTopLevel(inner: string, angle: boolean): string[] {
323 const out: string[] = [];
324 let depth = 0;
325 let start = 0;
326 for (let i = 0; i < inner.length; i++) {
327 const c = inner[i]!;
328 if (isOpener(c, angle)) depth++;
329 else if (isCloser(c, angle, inner[i - 1])) depth--;
330 else if (c === ',' && depth === 0) {
331 out.push(inner.slice(start, i));
332 start = i + 1;
333 }
334 }
335 out.push(inner.slice(start));
336 return out;
337}
338
339function isOpener(c: string, angle: boolean): boolean {
340 return c === '[' || c === '(' || (angle && c === '<');

Callers 2

declaredValueParametersFunction · 0.70
collectFunction · 0.70

Calls 3

isOpenerFunction · 0.85
isCloserFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected