# @wessberg/environment

> Environment variables for all environments.

Latest version **1.0.1** (published 2017-06-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @wessberg/environment
pnpm add @wessberg/environment
yarn add @wessberg/environment
bun add @wessberg/environment
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-06-03 |
| First published | 2017-05-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Frederik Wessberg |
| Maintainers | wessberg |
| Keywords | environment, env, config, process, shim |

## Links

- npm: https://www.npmjs.com/package/@wessberg/environment
- npm.io page: https://npm.io/package/@wessberg/environment

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.7.1

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-06-03
- 1.0.0 — 2017-05-24

## README

# Environment [![NPM version][npm-image]][npm-url]
> Environment variables for all environments.

## Installation
Simply do: `npm install @wessberg/environment`.

## Usage (with rollup)
Make sure to install the rollup plugin [rollup-plugin-environment](https://npmjs.org/package/@wessberg/rollup-plugin-environment) and add it to your rollup configuration:
```typescript
rollup({
  plugins: [
  	Environment(),
  	// Other plugins goes here...
  ]
});
```
This will just add a shim for the `process` object in top of the bundle, reflecting the environment set up by this package.

## Usage (in your code)
```typescript
import {Config, Environment, EnvironmentKind} from "@wessberg/environment";

if (Config.DEBUG) {
	// Do debug stuff here
}

if (Config.PRODUCTION) {
	// Do production stuff here
}

// Switch through the kinds of environments.
switch (Environment.KIND) {
	case EnvironmentKind.PRODUCTION:
	case EnvironmentKind.STAGING:
		// do stuff
		break;
	default:
		// do other stuff
		break;
}

```

## Changelog:

**v1.0.1**:

- Added a strict-boolean check for process.env variables.

**v1.0.0**:

- First release.

[npm-url]: https://npmjs.org/package/@wessberg/environment
[npm-image]: https://badge.fury.io/js/@wessberg/environment.svg

---
_Source: https://npm.io/package/@wessberg/environment · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
