(value: string, fallback: T)
| 191 | * Prevents crashes from corrupted database metadata. |
| 192 | */ |
| 193 | export function safeJsonParse<T>(value: string, fallback: T): T { |
| 194 | try { |
| 195 | return JSON.parse(value); |
| 196 | } catch { |
| 197 | return fallback; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Clamp a numeric value to a range. |
no outgoing calls
no test coverage detected