MCPcopy Create free account
hub / github.com/TanStack/devtools / tryParseJson

Function tryParseJson

packages/devtools/src/utils/sanitize.ts:1–8  ·  view source on GitHub ↗
(json: string | null)

Source from the content-addressed store, hash-verified

1export const tryParseJson = <T>(json: string | null): T | undefined => {
2 if (!json) return undefined
3 try {
4 return JSON.parse(json)
5 } catch (_e) {
6 return undefined
7 }
8}
9
10export const uppercaseFirstLetter = (value: string) =>
11 value.charAt(0).toUpperCase() + value.slice(1)

Callers 3

sanitize.test.tsFile · 0.90
getSettingsFunction · 0.90
getStateFromLocalStorageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected