# dein

> A small dependency injection framework for node.js.

Latest version **4.0.1** (published 2019-06-21) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2019-06-21 |
| First published | 2015-04-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 0 |
| Unpacked size | 12.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | mren |
| Maintainers | mren |

## Links

- npm: https://www.npmjs.com/package/dein
- Repository: https://github.com/mren/dein
- Homepage: https://github.com/mren/dein#readme
- Issues: https://github.com/mren/dein/issues
- npm.io page: https://npm.io/package/dein

## Recent versions

- 4.0.1 (latest) — 2019-06-21
- 4.0.0 — 2018-02-12
- 3.4.0 — 2017-08-14
- 3.3.0 — 2017-06-30
- 3.2.0 — 2017-04-18
- 3.1.0 — 2017-04-10
- 3.0.0 — 2017-01-12
- 2.6.0 — 2016-11-08
- 2.5.1 — 2016-11-08
- 2.5.0 — 2016-10-08
- 2.4.0 — 2016-09-26
- 2.3.1 — 2016-09-25
- 2.3.0 — 2016-08-29
- 2.2.0 — 2016-08-28
- 2.0.0 — 2016-06-08
- … 1 more at https://npm.io/package/dein/versions

## README

# dein - dependency injection framework

A small dependency injection framework for node.js.

- Register modules with dependencies.
- Register literals without dependencies.
- Dependency injection framework is immutable.

## Features

- dein is lazy. Only dependencies which are used are resolved
- dein allows async dependency resolution by using promises.
  You can mix synchronous factory methods with asynchronous ones.
- dein will automatically find the required dependency.
  No need to define the order of dependencies.

# Quick Start

```bash
npm install dein
```

```javascript
const dein = require('dein');
```

# Examples

```javascript
dein
  .registerLiteral('someString', 'Hello World')
  .register('someModule', someString => `${someString}!!!`)
  .resolve('someModule')
  .then((result) => {
    console.log('Result: ' + result);
    // Expected: `Result: Hello World!!!
  });
```

# Tests

```bash
npm test
```

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