MCPcopy Create free account
hub / github.com/TanStack/ai / formatValue

Function formatValue

examples/ts-react-native-chat/src/App.tsx:101–117  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

99}
100
101function formatValue(value: unknown): string {
102 if (value === undefined) return 'Not available yet'
103 if (typeof value === 'string') return value
104 if (
105 typeof value === 'number' ||
106 typeof value === 'boolean' ||
107 value === null
108 ) {
109 return String(value)
110 }
111
112 try {
113 return JSON.stringify(value, null, 2)
114 } catch {
115 return '[Unserializable value]'
116 }
117}
118
119function valueToString(value: unknown): string | undefined {
120 if (value === undefined || value === null) return undefined

Callers 1

valueToStringFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected