(str: string)
| 1 | import superjson from 'superjson'; |
| 2 | |
| 3 | export function getSafeJson<T>(str: string): T | null { |
| 4 | try { |
| 5 | return JSON.parse(str); |
| 6 | } catch (e) { |
| 7 | return null; |
| 8 | } |
| 9 | } |
| 10 | |
| 11 | export function getSuperJson<T>(str: string): T | null { |
| 12 | const json = getSafeJson<T>(str); |
no test coverage detected