mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-04-18 13:57:52 -04:00
* refactor: extract restic in core package * chore: add turbo task runner * refactor: split server utils * chore: simplify withDeps signature and fix non-null assertion
12 lines
184 B
TypeScript
12 lines
184 B
TypeScript
export function safeJsonParse<T>(input: string | null | undefined): T | null {
|
|
if (!input) {
|
|
return null;
|
|
}
|
|
|
|
try {
|
|
return JSON.parse(input) as T;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|