mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
18 lines
384 B
TypeScript
18 lines
384 B
TypeScript
export function getBrowserCompatibilityReport() {
|
|
const test = (snippet: string) => {
|
|
try {
|
|
(0, eval)(snippet);
|
|
return true;
|
|
} catch (e) {
|
|
return `FAILED: ${e}`;
|
|
}
|
|
};
|
|
|
|
return {
|
|
optionalChaining: test("({})?.b?.c"),
|
|
nullishCoalescing: test("0 ?? 1"),
|
|
weakRef: test("new WeakRef({})"),
|
|
cryptoUuid: test("crypto.randomUUID()"),
|
|
};
|
|
}
|