MCPcopy Create free account
hub / github.com/simstudioai/sim / safeStringValue

Function safeStringValue

apps/sim/app/api/telemetry/route.ts:17–27  ·  view source on GitHub ↗

* Safely converts a value to string, handling undefined and null values

(value: unknown)

Source from the content-addressed store, hash-verified

15 * Safely converts a value to string, handling undefined and null values
16 */
17function safeStringValue(value: unknown): string {
18 if (value === undefined || value === null) {
19 return ''
20 }
21
22 try {
23 return String(value)
24 } catch (_e) {
25 return ''
26 }
27}
28
29/**
30 * Creates a safe attribute object for OpenTelemetry

Callers 1

createSafeAttributesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected