1.0.2 • Published 2 months ago

@haensl/environments v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@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`

```javascript
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`

```javascript
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"
}

Changelog