MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / openBrackets

Function openBrackets

graph-ui/src/browser-ai/code-facts.ts:36–47  ·  view source on GitHub ↗

Brackets still open after `text`, outside strings.

(text: string)

Source from the content-addressed store, hash-verified

34
35/** Brackets still open after `text`, outside strings. */
36function openBrackets(text: string): number {
37 let depth = 0, quote: string | undefined;
38 for (let index = 0; index < text.length; index++) {
39 const character = text[index];
40 if (quote) { if (character === '\\') index++; else if (character === quote) quote = undefined; continue; }
41 if (character === '#') break;
42 if (character === '"' || character === "'") quote = character;
43 else if ('([{'.includes(character)) depth++;
44 else if (')]}'.includes(character)) depth--;
45 }
46 return depth;
47}
48
49/** The statement starting at `start`, joined over the lines its brackets keep open. */
50function statement(lines: readonly string[], start: number): { text: string; end: number } {

Callers 1

statementFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected