@haensl/environments

1.0.2 • Public • Published

@haensl/environments

JS runtime environments. Simple JSON object.

NPM

npm version CircleCI

Installation

Via npm

$ npm install -S @haensl/environments

Via yarn

$ yarn add @haensl/environments

Usage

  1. Install @haensl/environments

  2. Use environments in your projects:

    ESM, i.e. import

    import environments from '@haensl/environments';
    
    // Spreading the import works, too.
    // import { production } from '@haensl/environments';
    
    // ...
    
    if (currentEnvironment === environments.production) {
      // do stuff on production only
    }

    CJS, i.e. require

    const environments = require('@haensl/environments');
    
    // ...
    
    if (currentEnvironment === environments.production) {
      // do stuff on production only
    }

Synopsis

The environments object is a simple JSON object that maps to strings:

{
  "development": "development",
  "production": "production",
  "qa": "qa",
  "test": "test"
}

Package Sidebar

Install

npm i @haensl/environments

Weekly Downloads

14

Version

1.0.2

License

MIT

Unpacked Size

4.63 kB

Total Files

4

Last publish

Collaborators

  • haensl