MCPcopy Index your code
hub / github.com/simstudioai/sim / isAtDepthZero

Function isAtDepthZero

scripts/generate-docs.ts:2196–2203  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

2194 * Used to distinguish top-level keys from keys nested inside child objects.
2195 */
2196function 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
2205function parseFieldContent(fieldContent: string, toolPrefix?: string): any {
2206 // Only match `type:` that is at the top level of fieldContent (depth 0).

Callers 2

extractDescriptionFunction · 0.85
parseFieldContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected