Package Exports
- browser-or-node
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (browser-or-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Browser or Node.js
Check whether the code is running in the browser or node.js runtime.
Install
$ npm install --save browser-or-node
Usage
ES6 style import
import { isBrowser, isNode } from 'browser-or-node';
if (isBrowser) {
// do browser only stuff
}
if (isNode) {
// do node.js only stuff
}
ES5 style import
var jsEnv = require('browser-or-node');
if (jsEnv.isBrowser) {
// do browser only stuff
}
if (jsEnv.isNode) {
// do node.js only stuff
}
License
MIT © Dineshkumar Pandiyan