# env-variable

> Cross platform environment variables with process.env, window.name, location.hash and localStorage fallbacks

Latest version **0.0.6** (published 2020-01-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install env-variable
pnpm add env-variable
yarn add env-variable
bun add env-variable
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2020-01-29 |
| First published | 2014-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Arnout Kazemier |
| Maintainers | 3rdeden, v1 |
| Keywords | browser, env, environment variable, environment, fallback, location.hash, process.env, variable, window.name |

## Links

- npm: https://www.npmjs.com/package/env-variable
- Repository: https://github.com/3rd-Eden/env-variable
- Issues: https://github.com/3rd-Eden/env-variable/issues
- npm.io page: https://npm.io/package/env-variable

## 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

- 0.0.6 (latest) — 2020-01-29
- 0.0.5 — 2018-10-03
- 0.0.4 — 2018-02-26
- 0.0.3 — 2014-11-03
- 0.0.2 — 2014-09-11
- 0.0.1 — 2014-09-01
- 0.0.0 — 2014-05-28

## README

# env-variable

A cross platform `env-variable` for browsers and node. Of course, browsers
doesn't have environment variables but we do have hashtags and localStorage
which we will use as fallback.

### hashtags

This is a really easy way of adding some trigger some environment variables that
you might use for debugging. We assume that the hashtag (#) contains
a query string who's key is the name and the value.. the value.

### localStorage

If you want more persisting env variables you can set a query string of env
variables in localStorage. It will attempt to use the `env` variable.

## Installation

This module is written for node and browserify and can be installed using npm:

```
npm install --save env-variable
```

## Usage

This module exposes a node / `module.exports` interface.

```js
var env = require('env-variable')();
```

As you can see from the example above we execute the required module. You can
alternately store it but I don't assume this a common pattern. When you execute
the function it returns an object with all the env variables.

When you execute the function you can alternately pass it an object which will
be seen as the default env variables and all fallbacks and `process.env` will be
merged in to this object.

```js
var env = require('env-variable')({
  foo: 'bar',
  NODE_ENV: 'production'
});
```

Oh, in `env-variable` we don't really care how you write your env variables. We
automatically add an extra lower case version of the variables so you can access
everything in one consistent way.

And that's basically everything you need to know. *random high fives*.

## License

[MIT](LICENSE)

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