# @lds/universal-env

> Safe, universal environment variables in 3 easy steps

Latest version **1.0.3** (published 2019-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lds/universal-env
pnpm add @lds/universal-env
yarn add @lds/universal-env
bun add @lds/universal-env
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2019-03-21 |
| First published | 2018-03-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | blakeplumb, eatrocks, jnielson94, ldschurch, trevordmiller |

## Links

- npm: https://www.npmjs.com/package/@lds/universal-env
- npm.io page: https://npm.io/package/@lds/universal-env

## Dependencies (2)

- [is-in-browser](https://npm.io/package/is-in-browser.md) ^1.1.3
- [serialize-javascript](https://npm.io/package/serialize-javascript.md) ^1.4.0

## Recent versions

- 1.0.3 (latest) — 2019-03-21
- 1.0.2 — 2018-03-20
- 1.0.1 — 2018-03-20
- 1.0.0 — 2018-03-20

## README

# Universal Environment Variables

Safe, universal environment variables in 3 easy steps 😬.


## 1. Define what to share

Do this early in the application's lifecycle.

```
import { share } from "@lds/universal-env";

share("NODE_ENV", "GRAPHQL_ENDPOINT");
```


## 2. Populate a script tag in the document template

Add as script tag when generating the document. The script function returns a string of javascript.

```
import { script } from "@lds/universal-env";
<script>{script()}</script>
```


## 3. Access shared variables.

```
import { get } from "@lds/universal-env";

const { NODE_ENV, GRAPHQL_ENDPOINT } = get();
```

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