# simple-injection

> small ioc container and service locator

Latest version **0.0.4** (published 2019-01-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-injection
pnpm add simple-injection
yarn add simple-injection
bun add simple-injection
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2019-01-27 |
| First published | 2019-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Joao Jacome |
| Maintainers | joaojacome |
| Keywords | injection, typescript |

## Links

- npm: https://www.npmjs.com/package/simple-injection
- Repository: https://github.com/joaojacome/simple-injection
- Homepage: https://github.com/joaojacome/simple-injection#readme
- Issues: https://github.com/joaojacome/simple-injection/issues
- npm.io page: https://npm.io/package/simple-injection

## Dependencies (1)

- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2019-01-27
- 0.0.3 — 2019-01-27
- 0.0.2 — 2019-01-27
- 0.0.1 — 2019-01-27

## README

# Simple Injection
## Usage
### To register a service
``` javascript
import { Injectable, Inject } from 'simple-injection';

@Injectable
class Test {
    private n: number = 0;

    public add(nx: number) {
        this.n += nx;

        return this.n;
    }
}
```

### To inject a service
``` javascript
import { Inject } from 'simple-injection';

class Test2 {
    @Inject injectedService !: Test;

    public testThisInjection(n: number) {
        let sum = this.injectedService.add(n);
        console.log(sum);
    }
}
```

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