is-in-browser

Simple check to see if current app is running in browser

MIT 8 个版本
安装
npm install is-in-browser
yarn add is-in-browser
pnpm add is-in-browser
bun add is-in-browser
README

Is In Browser?

import isBrowser from "is-in-browser";

if (isBrowser) {
  //...
}

More thoroughly:

import { isJsDom, isNode, isBrowser } 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
}

CommonJS

For those not using Babel / ES6 Modules

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

if(isBrowser) { //... }
版本列表
2.0.0 2021-02-07
1.1.3 2017-01-15
1.1.2 2017-01-07
1.1.1 2017-01-07
1.1.0 2017-01-06
1.0.2 2016-10-22
1.0.1 2016-03-15
1.0.0 2016-03-15