mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-02-07 20:11:16 -05:00
* feat: background doctor operation * refactor(repo-details): design layout * refactor(doctor): support abort signal in all operations * chore: fix linting issue * chore: pr feedbacks * chore: merge conflicts * refactor: handle aborted signal in all operations * chore: pr feedbacks * chore: remove old migration
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;
|
|
}
|
|
}
|