# miljo

> A simple package to retrieve environment variables

Latest version **1.0.0** (published 2019-08-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install miljo
pnpm add miljo
yarn add miljo
bun add miljo
```

## 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.0.0 |
| Published | 2019-08-01 |
| First published | 2019-08-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jonas Anker Jahr |
| Maintainers | ankerdev |
| Keywords | Config, Env, Env var, Environment variables, JavaScript, Node.js, TypeScript |

## Links

- npm: https://www.npmjs.com/package/miljo
- npm.io page: https://npm.io/package/miljo

## Dependencies (1)

- [dotenv](https://npm.io/package/dotenv.md) ^8.0.0

## 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.0 (latest) — 2019-08-01

## README

# miljo
A simple module to load environment variables from a `.env` file, and convert them to their respective type.
It currently handles `string`, `number` (integer and float) and `boolean` values.

## Signature
```ts
(key: string, fallback?: any) => any;
```

## Usage
`.env` file:
```
NODE_ENV=production
THROTTLE_REQUESTS=true 
REQUESTS_PER_MIN=10.5
```

`.js`/`.ts` file:
```ts
import { env } from 'miljo';
const nodeEnv: string = env('NODE_ENV', 'development');
const throttleRequests: boolean = env('THROTTLE_REQUESTS');
const requestsPerMin: number = env('THROTTLE_REQUESTS', 1);
```

Would output:
```ts
nodeEnv => (string) 'production';
throttleRequests => (boolean) true;
requestsPerMin => (number) 10.5;
```

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