MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / readBalancedBlock

Function readBalancedBlock

packages/cli/src/commands/keyframes.ts:263–277  ·  view source on GitHub ↗
(text: string, openBrace: number)

Source from the content-addressed store, hash-verified

261// ── CSS / Anime extraction ───────────────────────────────────────────────────
262
263function readBalancedBlock(text: string, openBrace: number): { body: string; end: number } | null {
264 if (text[openBrace] !== "{") return null;
265 let depth = 0;
266 for (let i = openBrace; i < text.length; i++) {
267 const ch = text[i];
268 if (ch === "{") depth++;
269 else if (ch === "}") {
270 depth--;
271 if (depth === 0) {
272 return { body: text.slice(openBrace + 1, i), end: i + 1 };
273 }
274 }
275 }
276 return null;
277}
278
279function parseDeclarations(body: string): string[] {
280 return body

Callers 1

collectKeyframeBlocksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected