From 1e3258cfe2058644d8ef8b02ac1d5cf3705fd146 Mon Sep 17 00:00:00 2001 From: Damian Tarnawski Date: Wed, 6 Sep 2023 12:05:39 +0200 Subject: [PATCH] platform: correct vars --- packages/platform/src/index.ts | 4 ++-- packages/platform/test/server.test.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/platform/src/index.ts b/packages/platform/src/index.ts index 06131d2ca..ca302a826 100644 --- a/packages/platform/src/index.ts +++ b/packages/platform/src/index.ts @@ -48,7 +48,7 @@ export const isOpera: boolean = /** Browser is Safari */ export const isSafari: boolean = - n.vendor && n.vendor.includes("Apple") && ua && !ua.includes("CriOS") && !ua.includes("FxiOS"); + !!n.vendor && n.vendor.includes("Apple") && ua && !ua.includes("CriOS") && !ua.includes("FxiOS"); /** Browser is Internet Explorer 6-11 */ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition @@ -64,7 +64,7 @@ export const isEdge: boolean = /*#__PURE__*/ /Edg/.test(ua) && isChromium; export const isChrome: boolean = isChromium && n.vendor === "Google Inc." && !isOpera && !isEdge; /** Browser is Brave */ -export const isBrave: boolean = n.brave && n.brave.isBrave && n.brave.isBrave.name === "isBrave"; +export const isBrave: boolean = !!n.brave && n.brave.isBrave && n.brave.isBrave.name === "isBrave"; // // Rendering Engines diff --git a/packages/platform/test/server.test.ts b/packages/platform/test/server.test.ts index c703ac4ff..365acfeec 100644 --- a/packages/platform/test/server.test.ts +++ b/packages/platform/test/server.test.ts @@ -28,6 +28,7 @@ describe("platform", () => { expect(platform.isChromium).toBe(false); expect(platform.isEdge).toBe(false); expect(platform.isChrome).toBe(false); + expect(platform.isBrave).toBe(false); // // Rendering Engines