Skip to content

A collection of runtime environment utilities and indicators

Notifications You must be signed in to change notification settings

sahariko/environment

Repository files navigation

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

About

A collection of runtime environment utilities and indicators

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •