MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getSafeJson

Function getSafeJson

packages/json/index.ts:3–9  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

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

Callers 12

processBufferMethod · 0.90
fetchFromCacheMethod · 0.90
fetchFromCacheMethod · 0.90
processBufferMethod · 0.90
getExistingSessionMethod · 0.90
processBufferMethod · 0.90
getClickhouseSettingsFunction · 0.90
sampleOldestSessionFunction · 0.90
mainFunction · 0.90
parseScalarFunction · 0.90
getSuperJsonFunction · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected