@cocopina/environment

1.0.4 • Public • Published

environment

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

Package Sidebar

Install

npm i @cocopina/environment

Weekly Downloads

3,331

Version

1.0.4

License

ISC

Unpacked Size

10.4 kB

Total Files

5

Last publish

Collaborators

  • cocopina