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

Function sanitizeEnum

apps/sim/tools/monday/utils.ts:40–50  ·  view source on GitHub ↗
(
  value: string | undefined,
  paramName: string,
  allowed: readonly string[]
)

Source from the content-addressed store, hash-verified

38 * rejecting anything outside the provided set.
39 */
40export function sanitizeEnum(
41 value: string | undefined,
42 paramName: string,
43 allowed: readonly string[]
44): string {
45 const normalized = typeof value === 'string' ? value.trim() : ''
46 if (!allowed.includes(normalized)) {
47 throw new Error(`Invalid ${paramName}: "${value}". Expected one of: ${allowed.join(', ')}`)
48 }
49 return normalized
50}
51
52export function extractMondayError(data: Record<string, unknown>): string | null {
53 if (data.errors && Array.isArray(data.errors) && data.errors.length > 0) {

Callers 2

create_column.tsFile · 0.90
create_board.tsFile · 0.90

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected