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

Function braceBody

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

From the index of an opening `{`, return the brace-balanced body up to its matching `}`.

(src: string, openIdx: number)

Source from the content-addressed store, hash-verified

2169
2170/** From the index of an opening `{`, return the brace-balanced body up to its matching `}`. */
2171function braceBody(src: string, openIdx: number): string | null {
2172 let depth = 0;
2173 for (let i = openIdx; i < src.length; i++) {
2174 if (src[i] === '{') depth++;
2175 else if (src[i] === '}' && --depth === 0) return src.slice(openIdx + 1, i);
2176 }
2177 return null;
2178}
2179
2180/** Top-level `key: Identifier` entries of an object-literal body. DEPTH-AWARE: only depth-0
2181 * segments are considered, so method-shorthand bodies (`number(a,b){…}`), arrow values

Callers 1

objectRegistryEdgesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected