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

Function extractDescription

scripts/generate-docs.ts:1593–1604  ·  view source on GitHub ↗

* Extract description from field content, handling quoted strings properly. * Handles single quotes, double quotes, and backticks, preserving internal quotes.

(fieldContent: string)

Source from the content-addressed store, hash-verified

1591 * Handles single quotes, double quotes, and backticks, preserving internal quotes.
1592 */
1593function extractDescription(fieldContent: string): string | null {
1594 // Walk through all `description:` matches and return the first one at depth 0.
1595 // This prevents accidentally picking up `description:` keys inside nested child objects.
1596 const descRegex = /description\s*:\s*('([^']*)'|"([^"]*)"|`([^`]*)`)/g
1597 let m: RegExpExecArray | null
1598 while ((m = descRegex.exec(fieldContent)) !== null) {
1599 if (isAtDepthZero(fieldContent, m.index)) {
1600 return m[2] ?? m[3] ?? m[4] ?? null
1601 }
1602 }
1603 return null
1604}
1605
1606function parseConstFieldContent(
1607 fieldContent: string,

Callers 3

parseConstFieldContentFunction · 0.85
parseFieldContentFunction · 0.85

Calls 1

isAtDepthZeroFunction · 0.85

Tested by

no test coverage detected