# string-env-interpolation

> Use Environment Variables in String

Latest version **1.0.1** (published 2020-06-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install string-env-interpolation
pnpm add string-env-interpolation
yarn add string-env-interpolation
bun add string-env-interpolation
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-06-02 |
| First published | 2020-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Kamil Kisiela |
| Maintainers | kamilkisiela |

## Links

- npm: https://www.npmjs.com/package/string-env-interpolation
- Repository: https://github.com/kamilkisiela/string-env-interpolation
- Homepage: https://github.com/kamilkisiela/string-env-interpolation#readme
- Issues: https://github.com/kamilkisiela/string-env-interpolation/issues
- npm.io page: https://npm.io/package/string-env-interpolation

## Recent versions

- 1.0.1 (latest) — 2020-06-02
- 1.0.0 — 2020-06-02

## README

# string-env-interpolation

Use string interpolation to provide Environment Variables.

## Installation

    yarn add string-env-interpolation
    npm install string-env-interpolation

## Usage

Let's say we have a config file: `config.yaml`.

```yaml
debug: ${DEBUG:false}
name: ${NAME:"Development"}
user: ${USER}
```

Our library wants to be able to consume environment variables in `index.js`.

```typescript
import { env } from "string-env-interpolation";
import { readFileSync } from "fs";

const content = env(readFileSync("./config.yaml", "utf-8"));

console.log(content);
```

Outputs:

```bash
DEBUG=true USER=kamil node index.js

# Output
debug: true
name: Development
user: kamil



NAME=Production USER=kamil node index.js

# Output
debug: false
name: Production
user: kamil
```

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