actress-env

0.1.2 • Public • Published

actress-env

NPM Version NPM Downloads

Check features of the current environment. You can have a window in your Node, Webpack, React Native, or Cordova environment, but it doesn't necessarily mean it's a browser. This is where this package comes in. Distinguish target and features of your current environment!

Installation

npm i -S actress-env

Usage

Include the library:

    // CommonJS
    const actressEnv = require('actress-env')
    
    // or AMD
    define(['actress-env'], (actressEnv) => {
        // ...
    })
 
    // or accessible via script tag on `window.__actressEnv__`
    // <script src="actress-env.js"></script>

Examples

If you're in a webpack or browserify like environment, you may receive an object similar to this:

console.log(require('actress-env'))
{
  "target": "browser",
  "isBrowser": true,
  "isBundler": true,
  "isReactNative": false,
  "isNode": false,
  "hasRequire": true,
  "hasWindow": true,
  "hasProcess": true,
  "hasGlobal": true
}

Package Sidebar

Install

npm i actress-env

Weekly Downloads

12

Version

0.1.2

License

MIT

Last publish

Collaborators

  • samhunta