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

Function validateMermaidSource

apps/sim/lib/mermaid/validate.ts:9–22  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

7}
8
9export async function validateMermaidSource(source: string): Promise<MermaidValidationResult> {
10 try {
11 const { default: mermaid } = await import('mermaid')
12 await mermaid.parse(source)
13 return { ok: true }
14 } catch (error) {
15 const err = toError(error)
16 return {
17 ok: false,
18 error: err.message || 'Invalid Mermaid diagram',
19 errorName: err.name || 'MermaidParseError',
20 }
21 }
22}

Callers 2

readFileContentMethod · 0.90
route.tsFile · 0.90

Calls 2

toErrorFunction · 0.90
parseMethod · 0.80

Tested by

no test coverage detected