1.0.0 • Published 4 years ago

env-crosser v1.0.0

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

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.