tuxsudo / is-in-browser

Detect if the current env is the browser

Repository from Github https://github.comtuxsudo/is-in-browserRepository from Github https://github.comtuxsudo/is-in-browser

Is In Browser?

import isBrowser from "is-in-browser";

if (isBrowser) {
  //...
}

More thoroughly:

import { isJsDom, isNode, isBrowser, isDeno } from "is-in-browser";

if (isBrowser) {
  // you're in the browser
  // jsdom considered in browser
}

if (isJsDom) {
  // you're in the JSDom
}

if (isNode) {
  // you're in the Node
}

if (isDeno) {
  // you're in the Deno
}

CommonJS

For those not using Babel / ES6 Modules

var isBrowser = require('is-in-browser').default;

if(isBrowser) { //... }

About

Detect if the current env is the browser

License:MIT License


Languages

Language:TypeScript 81.0%Language:JavaScript 19.0%