(data: unknown)
| 126 | * Returns undefined for null, undefined, or non-serializable types. |
| 127 | */ |
| 128 | export function serializeForDisplay(data: unknown): string | undefined { |
| 129 | if (data === null || data === undefined) { |
| 130 | return undefined |
| 131 | } |
| 132 | |
| 133 | switch (typeof data) { |
| 134 | case "object": |
| 135 | return JSON.stringify(data, null, 2) |
| 136 | case "string": |
| 137 | case "number": |
| 138 | case "boolean": |
| 139 | return String(data) |
| 140 | default: |
| 141 | return undefined |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Custom error class to normalize fetch errors into a consistent structure. |
no outgoing calls
no test coverage detected
searching dependent graphs…