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

Function findMatchingClose

scripts/generate-docs.ts:173–187  ·  view source on GitHub ↗

* Find the position after the matching close delimiter for an opening delimiter. * Assumes `content[openPos]` is the opening char (e.g. `{` or `[`). * Returns the index one past the matching close char, or -1 if unbalanced.

(
  content: string,
  openPos: number,
  openChar = '{',
  closeChar = '}'
)

Source from the content-addressed store, hash-verified

171 * Returns the index one past the matching close char, or -1 if unbalanced.
172 */
173function findMatchingClose(
174 content: string,
175 openPos: number,
176 openChar = '{',
177 closeChar = '}'
178): number {
179 let count = 1
180 let pos = openPos + 1
181 while (pos < content.length && count > 0) {
182 if (content[pos] === openChar) count++
183 else if (content[pos] === closeChar) count--
184 pos++
185 }
186 return count === 0 ? pos : -1
187}
188
189interface TriggerInfo {
190 id: string

Callers 15

generateIconMappingFunction · 0.85
extractOAuthServiceIdFunction · 0.85
extractTriggersAvailableFunction · 0.85
extractAllBlockConfigsFunction · 0.85
extractTagsFromBlockMetaFunction · 0.85
resolveConstReferenceFunction · 0.85
parseConstPropertiesFunction · 0.85
parseConstFieldContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected