chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:34:48 +08:00
commit 77bb5bf71f
3762 changed files with 353249 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
export const safeJsonParse = <T extends unknown>(
str: string
): { success: true; data: T } | { success: false; err: Error } => {
try {
const object: T = JSON.parse(str)
return { success: true, data: object }
} catch (thrown) {
const err = thrown instanceof Error ? thrown : new Error(String(thrown))
return { success: false, err }
}
}