1.0.0 • Published 4 years ago
env-crosser v1.0.0
Env crosser
Return a specific value depending on the environment.
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.