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

Function readChain

src/resolution/frameworks/angular-router.ts:510–521  ·  view source on GitHub ↗
(open: number, links: readonly string[])

Source from the content-addressed store, hash-verified

508 if (content && root && chain.length > 0) {
509 const safe = stripCommentsForRegex(content, 'typescript');
510 const readChain = (open: number, links: readonly string[]): string | null => {
511 let start = open;
512 let end = matchBracket(safe, start);
513 for (let i = 0; i < links.length && end > start; i++) {
514 const field = readFields(safe, start, end).get(links[i]!);
515 if (!field) return null;
516 if (i === links.length - 1) return field.text.trim();
517 start = safe.indexOf('{', field.at);
518 end = start < 0 ? -1 : matchBracket(safe, start);
519 }
520 return null;
521 };
522 const decl = new RegExp(String.raw`\b(?:const|let)\s+${escapeRegExp(root)}\s*(?::[^=]+)?=\s*\{`).exec(safe);
523 const enumDecl = decl ? null : new RegExp(String.raw`\benum\s+${escapeRegExp(root)}\s*\{`).exec(safe);
524 const classDecl = decl || enumDecl ? null : new RegExp(String.raw`\bclass\s+${escapeRegExp(root)}\b[^{]*\{`).exec(safe);

Callers 1

constantTextFunction · 0.85

Calls 3

matchBracketFunction · 0.90
readFieldsFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected