1.0.4 • Published 5 years ago

@cocopina/environment v1.0.4

Weekly downloads
2,444
License
ISC
Repository
github
Last release
5 years ago

environment npm.io

A collection of runtime environment utilities and indicators, providing an easy interface to decipher the current runtime environment.

Table of Contents

Installation

Install the package:

npm i @cocopina/environment

API

globalScope [Object]

The global scope, can be either "global" or "window".

Examples

// Browser

import { globalScope } from '@cocopina/environment';

console.log(globalScope === window); // true
// Node

const { globalScope } = require('@cocopina/environment');

console.log(globalScope === global); // true

node [Boolean]

Whether the current enironment is a node-like environment.

Examples

// Browser

import { node } from '@cocopina/environment';

console.log(node); // false
// Node

const { node } = require('@cocopina/environment');

console.log(node); // true

browser [Boolean]

Whether the current enironment is a browser environment.

Examples

// Browser

import { browser } from '@cocopina/environment';

console.log(browser); // true
// Node

const { browser } = require('@cocopina/environment');

console.log(browser); // false