Skip to content

Commit

Permalink
adding safe validation
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelrhmanMagdy committed Jul 30, 2024
1 parent 0c09656 commit 964ecf6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/clarity-js/src/data/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ let rootDomain = null;
export function start(): void {
rootDomain = null;
const ua = navigator && "userAgent" in navigator ? navigator.userAgent : Constant.Empty;
const timezone = Intl?.DateTimeFormat().resolvedOptions().timeZone ?? '';
const timezone = Intl?.DateTimeFormat()?.resolvedOptions()?.timeZone ?? '';
const timezoneOffset = new Date().getTimezoneOffset().toString();
const ancestorOrigins = Array.from(window.location.ancestorOrigins).toString();
const ancestorOrigins = window.location.ancestorOrigins ? Array.from(window.location.ancestorOrigins).toString() : '';
const title = document && document.title ? document.title : Constant.Empty;
electron = ua.indexOf(Constant.Electron) > 0 ? BooleanFlag.True : BooleanFlag.False;

Expand Down

0 comments on commit 964ecf6

Please sign in to comment.