mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 14:25:02 +00:00
26 lines
472 B
TypeScript
26 lines
472 B
TypeScript
export const extractFunctionBody = (content: string, startIndex: number): string => {
|
|
let braceCount = 0
|
|
let inFunction = false
|
|
let result = ''
|
|
|
|
for (let i = startIndex; i < content.length; i++) {
|
|
const char = content[i]
|
|
|
|
if (char === '{') {
|
|
inFunction = true
|
|
braceCount++
|
|
}
|
|
|
|
if (inFunction) {
|
|
result += char
|
|
|
|
if (char === '}') {
|
|
braceCount--
|
|
if (braceCount === 0) break
|
|
}
|
|
}
|
|
}
|
|
|
|
return result
|
|
}
|