JS runtime environments. Simple JSON object.
$ npm install -S @haensl/environments
$ yarn add @haensl/environments
-
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 }
The environments
object is a simple JSON object that maps to strings:
{
"development": "development",
"production": "production",
"qa": "qa",
"test": "test"
}