# deepin

> A Nodejs DI container

Latest version **1.0.6** (published 2017-03-31) · MIT license · 0 weekly downloads

## Install

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

## 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 | 1.0.6 |
| Published | 2017-03-31 |
| First published | 2016-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Marvin Frachet |
| Maintainers | skahrz |

## Links

- npm: https://www.npmjs.com/package/deepin
- Repository: https://github.com/Skahrz/deepin
- Issues: https://github.com/Skahrz/deepin/issues
- npm.io page: https://npm.io/package/deepin

## Dependencies (1)

- [matcha](https://npm.io/package/matcha.md) ^0.7.0

## Recent versions

- 1.0.6 (latest) — 2017-03-31
- 1.0.4 — 2016-08-03
- 1.0.3 — 2016-06-03
- 1.0.2 — 2016-06-02
- 1.0.1 — 2016-06-02

## README

<p>
<a href="https://travis-ci.org/Skahrz/deepin"><img src="https://travis-ci.org/Skahrz/deepin.svg?branch=master"/></a>
<a href='https://coveralls.io/github/Skahrz/deepin?branch=master'><img src='https://coveralls.io/repos/github/Skahrz/deepin/badge.svg?branch=master' alt='Coverage Status' /></a>
<img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg"/>
<img src="https://camo.githubusercontent.com/3b4ab215354d288be2f370236004672682b54a7e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d6d69742d626c75652e737667" data-canonical-src="https://img.shields.io/badge/license-mit-blue.svg">
</p>

Manage objects creation and dependencies using a descriptive way. It's a simple approach to inversion of control.

*It currently only supports constructor injection by order, not by name*

## Install

```
$ yarn add deepin
```

## Usage
```javascript
/* importing UserController, UserService & UserRepository... */
import {Dependency, Injector} from 'deepin'

const injector = Injector.createAndResolve([
  new Dependency('UserController', {useClass: UserController}, ['UserService']),
  new Dependency('UserService', {useClass: UserService}, ['UserRepository']),
  new Dependency('UserRepository', {useClass: UserRepository})
])

/**
 * Create a brand new instance of the UserController
 * on each call
 */
const userController = injector.get('UserController')

/**
 * Always retrieve the SAME instance of a UserController
 */
const userController = injector.getUnique('UserController')
```
Shortcut usage for useClass :
```javascript
/* importing UserController, UserService & UserRepository... */
import {give, Injector} from 'deepin'

const injector = Injector.createAndResolve([
  give(UserController, ['UserService']),
  give(UserService, ['UserRepository']),
  give(UserRepository)
])
```

## See also

- [API documentation](API.md)
- [Benchmarks](BENCHMARK.md)

## License

Copyright (c) 2017 Marvin Frachet

Licensed under the MIT license.

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