Check if it's Node.js or browser environment.
Installation
Yarn
yarn add is-web
npm
npm install is-web
Usage
import isWeb from 'is-web';
if (isWeb) {
console.log('Hello from the Browser!');
} else {
console.log('Hello from the Node.js!');
}