4fc1aa6d40
* Initiale drag and drop moving to group * Update some styling * Reenable ungrouped groups * Support moving to ungrouped from dropdown * Remove unneeded comments * undo unnecessary groupId changes * group cleanup * clean up drag logic --------- Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
13 lines
334 B
TypeScript
13 lines
334 B
TypeScript
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export const safeParse = <Result = any>(
|
|
json: string,
|
|
guard?: (data: unknown) => data is Result
|
|
): Result | null => {
|
|
try {
|
|
const parsed = JSON.parse(json) as Result
|
|
return guard ? (guard(parsed) ? parsed : null) : parsed
|
|
} catch {
|
|
return null
|
|
}
|
|
}
|