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

Function extractEnumPropertyFromContent

scripts/generate-docs.ts:1224–1247  ·  view source on GitHub ↗

* Extract an enum property value from block content. Maps an `IntegrationType` * enum key (e.g. `Communication`) to its slug value (e.g. `'communication'`). * Mirrors `apps/sim/blocks/types.ts → IntegrationType` — keep in sync.

(content: string, propName: string)

Source from the content-addressed store, hash-verified

1222 * Mirrors `apps/sim/blocks/types.ts → IntegrationType` — keep in sync.
1223 */
1224function extractEnumPropertyFromContent(content: string, propName: string): string | null {
1225 const match = content.match(new RegExp(`${propName}\\s*:\\s*IntegrationType\\.(\\w+)`))
1226 if (!match) return null
1227 const enumKey = match[1]
1228 const ENUM_MAP: Record<string, string> = {
1229 AI: 'ai',
1230 Analytics: 'analytics',
1231 Commerce: 'commerce',
1232 Communication: 'communication',
1233 Databases: 'databases',
1234 DevOps: 'devops',
1235 Documents: 'documents',
1236 Email: 'email',
1237 HR: 'hr',
1238 Marketing: 'marketing',
1239 Observability: 'observability',
1240 Productivity: 'productivity',
1241 Sales: 'sales',
1242 Search: 'search',
1243 Security: 'security',
1244 Support: 'support',
1245 }
1246 return ENUM_MAP[enumKey] || enumKey.toLowerCase()
1247}
1248
1249/**
1250 * Extract a string array property from block content.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected