Skip to content

Commit

Permalink
Merge pull request #367 from oddnavy/david/react-native-support
Browse files Browse the repository at this point in the history
tweak util-checks for react native support
  • Loading branch information
DavidWells authored May 27, 2023
2 parents cc3e7c4 + b6d101e commit 9efe41e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/analytics-util-types/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const isStaging = ENV === 'staging'
export const isDev = ENV === 'development'

/** @type {Boolean} */
export const isBrowser = typeof window !== UNDEFINED
export const isBrowser = typeof document !== UNDEFINED
/** @type {Boolean} */
export const isLocalHost = isBrowser && window.location.hostname === 'localhost'

Expand All @@ -74,7 +74,7 @@ export const isDeno = typeof Deno !== UNDEFINED && typeof Deno.core !== UNDEFINE
export const isWebWorker = typeof self === OBJECT && self.constructor && self.constructor.name === 'DedicatedWorkerGlobalScope'

/** @type {Boolean} */
export const isJsDom = (isBrowser && window.name === 'nodejs') || (typeof navigator !== UNDEFINED && (navigator.userAgent.includes('Node.js') || navigator.userAgent.includes('jsdom')))
export const isJsDom = (isBrowser && window.name === 'nodejs') || (typeof navigator !== UNDEFINED && typeof navigator.userAgent !== UNDEFINED && (navigator.userAgent.includes('Node.js') || navigator.userAgent.includes('jsdom')))

/* ────────────────────
Type checks
Expand Down

0 comments on commit 9efe41e

Please sign in to comment.