* Returns true if the regex match at `matchIndex` within `content` is at brace depth 0. * Used to distinguish top-level keys from keys nested inside child objects.
(content: string, matchIndex: number)
| 2194 | * Used to distinguish top-level keys from keys nested inside child objects. |
| 2195 | */ |
| 2196 | function isAtDepthZero(content: string, matchIndex: number): boolean { |
| 2197 | let depth = 0 |
| 2198 | for (let i = 0; i < matchIndex; i++) { |
| 2199 | if (content[i] === '{') depth++ |
| 2200 | else if (content[i] === '}') depth-- |
| 2201 | } |
| 2202 | return depth === 0 |
| 2203 | } |
| 2204 | |
| 2205 | function parseFieldContent(fieldContent: string, toolPrefix?: string): any { |
| 2206 | // Only match `type:` that is at the top level of fieldContent (depth 0). |
no outgoing calls
no test coverage detected