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

Function validateName

apps/sim/lib/core/utils/validation.ts:28–32  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

26 * @returns The validated name with invalid characters removed, trimmed, and collapsed whitespace
27 */
28export function validateName(name: string): string {
29 return name
30 .replace(/[^a-zA-Z0-9_\s]/g, '') // Remove invalid characters
31 .replace(/\s+/g, ' ') // Collapse multiple spaces into single spaces
32}
33
34/**
35 * Checks if a name contains invalid characters

Callers 2

utils.test.tsFile · 0.90
VariablesFunction · 0.90

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected