Skip to content

Instantly share code, notes, and snippets.

@danieljpgo
Last active January 28, 2022 22:52
Show Gist options
  • Save danieljpgo/793be994d9d7c85beca67ac3cf4e7853 to your computer and use it in GitHub Desktop.
Save danieljpgo/793be994d9d7c85beca67ac3cf4e7853 to your computer and use it in GitHub Desktop.
/lib
/**
* Checks if the code is running in the `browser`.
*/
export function isBrowser() {
return typeof window === 'object';
}
/**
* Checks if the code is running in the `server`.
*/
export function isServer() {
return typeof window === 'undefined';
}
/**
* Checks if the browser is `Internet Explorer`.
*/
export function isInternetExplorer() {
return /* @cc_on!@ */ false || !!document.documentMode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment