Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
fix(utils): Add guard for undefined navigator
Browse files Browse the repository at this point in the history
  • Loading branch information
skjalgepalg committed Nov 22, 2022
1 parent a67382e commit f9c6ebb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const IS_BROWSER = typeof window !== 'undefined'
export const IS_ANDROID = IS_BROWSER && /(android)/i.test(navigator.userAgent) // Bad, but needed
export const IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(String(navigator.platform))
const HAS_NAVIGATOR = IS_BROWSER && typeof window.navigator !== 'undefined'
export const IS_ANDROID = HAS_NAVIGATOR && /(android)/i.test(navigator.userAgent) // Bad, but needed
export const IS_IOS = HAS_NAVIGATOR && /iPad|iPhone|iPod/.test(String(navigator.platform))
export const IS_IE11 = IS_BROWSER && window.msCrypto // msCrypto only exists in IE11

// Mock HTMLElement for Node
Expand Down

0 comments on commit f9c6ebb

Please sign in to comment.