# @webacad/env

> .env file loader written in typescript

Latest version **1.3.1** (published 2018-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @webacad/env
pnpm add @webacad/env
yarn add @webacad/env
bun add @webacad/env
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2018-06-12 |
| First published | 2018-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | David Kudera |
| Maintainers | davidkcz |
| Keywords | dotenv, env |

## Links

- npm: https://www.npmjs.com/package/@webacad/env
- Repository: https://github.com/Web-ACAD/js-env
- Homepage: https://github.com/Web-ACAD/js-env#readme
- Issues: https://github.com/Web-ACAD/js-env/issues
- npm.io page: https://npm.io/package/@webacad/env

## Dependencies (1)

- [dotenv](https://npm.io/package/dotenv.md) ^5.0.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.3.1 (latest) — 2018-06-12
- 1.3.0 — 2018-06-09
- 1.2.0 — 2018-06-09
- 1.1.0 — 2018-06-09
- 1.0.0 — 2018-04-03
- 0.0.3 — 2018-03-26
- 0.0.2 — 2018-03-25
- 0.0.1 — 2018-03-24

## README

[![NPM version](https://img.shields.io/npm/v/@webacad/env.svg?style=flat-square)](https://www.npmjs.com/package/@webacad/env)
[![Build Status](https://img.shields.io/travis/Web-ACAD/js-env.svg?style=flat-square)](https://travis-ci.org/Web-ACAD/js-env)

# WebACAD/Env

.env file loader written in typescript

## Installation

```bash
$ npm install --save @webacad/env
```

or with yarn

```bash
$ yarn add @webacad/env
```

## Usage

```typescript
import {loadEnv} from '@webacad/env';

const env = loadEnv('path/to/.env');
```

## Load env with schema

By default all values are returned as strings. This can be changed by providing schema where you can define returned types.

```typescript
import {loadEnv} from '@webacad/env';

const env = loadEnv('path/to/.env', {
    NODE_ENV: {
    	type: 'string',
    	required: true,
    },
    SERVER_PORT: {
    	type: 'number',
    },
    SOURCE_MAPS: {
    	type: 'boolean',
    	default: true,
    },
});
```

**Options:**

* `type`: `"string"`, `"number"` or `"boolean"` (default: `"string"`)
* `required`: `boolean` (default: `false`)
* `default`: `any` or `function`

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