mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-19 07:51:38 +00:00
9 lines
221 B
TypeScript
9 lines
221 B
TypeScript
/** Parses JSON without throwing, returning undefined for invalid input. */
|
|
export function safeParseJson(value: string): unknown {
|
|
try {
|
|
return JSON.parse(value) as unknown;
|
|
} catch {
|
|
return undefined;
|
|
}
|
|
}
|