env-crosser
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Env crosser Travis CI Build Status

Return a specific value depending on the environment.

NPM Badge

Install

npm install env-crosser

Usage

const envCrosser = require("env-crosser");

envCrosser({
    browser: "Browser!",
    worker: "Web Worker!",
    node: "NodeJS!",
    fallback: "???"
})
//=> "NodeJS!" (When using NodeJS)

API

envCrosser(values)

values

Type: object

browser

Type: any

The value to return in a browser.

worker

Type: any

The value to return in a web worker.

node

Type: any

The value to return in NodeJS.

fallback

Type: any

The value to fall back to if all the other checks fail or a corresponding value isn't provided.

Readme

Keywords

Package Sidebar

Install

npm i env-crosser

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.15 kB

Total Files

7

Last publish

Collaborators

  • richienb