UNPKG

is-in-browser

Version:

Simple check to see if current app is running in browser

10 lines (7 loc) 293 B
import { isBrowser, isNode, isJsDom } from "./index"; console.log(isBrowser ? "❌" : "✅", "browser:", isBrowser); console.log(isNode ? "✅" : "❌", "node:", isNode); console.log(isBrowser ? "❌" : "✅", "js-dom:", isJsDom); if (isBrowser || !isNode || isJsDom) { process.exit(1); }