Server sent event response viewer (#126)

This commit is contained in:
Gregory Schier
2024-10-11 06:52:32 -07:00
committed by GitHub
parent f974a66086
commit d754e7233d
24 changed files with 513 additions and 104 deletions

View File

@@ -35,3 +35,15 @@ function detectFromContent(
return fallback;
}
export function isJSON(content: string | null | undefined): boolean {
if (typeof content !== 'string') return false;
try {
JSON.parse(content)
return true;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
return false;
}
}