# inversification

> A simple decorator-based IOC container

Latest version **1.1.1-depr1** (published 2022-08-14) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.1-depr1 |
| Published | 2022-08-14 |
| First published | 2022-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nenad Petkovic |
| Maintainers | enpi |
| Keywords | IOC, inversion of control, typescript, inversification, lib |

## Links

- npm: https://www.npmjs.com/package/inversification
- Repository: https://github.com/abraxas-von-abrasax/inversification
- Homepage: https://github.com/abraxas-von-abrasax/inversification#readme
- Issues: https://github.com/abraxas-von-abrasax/inversification/issues
- npm.io page: https://npm.io/package/inversification

## 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

- 1.1.1-depr1 (latest) — 2022-08-14
- 1.1.1-depr — 2022-08-13
- 1.1.0-depr — 2022-08-13
- 1.0.1 — 2022-08-12
- 1.0.0 — 2022-08-12

## README

# Inversification

===================

## Deprecation
Deprecated in favor of [https://www.npmjs.com/package/@inversification/ioc](https://www.npmjs.com/package/@inversification/ioc)

===================

A simple, lightweight, dependency-free and decorator-based IOC container for Node

## Usage

Register a class with the `@injectable` decorator:

```typescript
// inject-me.ts

import { injectable } from 'inversification';

@injectable()
export class InjectMe {
    doThings() {
        console.log('A thing');
    }
}
```

Inject your service with the property decorator `@inject`:

```typescript
// consumer.ts

import { inject } from 'inversification';
import { InjectMe } from './inject-me.ts';

export class Consumer {
    @inject(InjectMe.name) private service: InjectMe;

    callMe() {
        this.service.doThings();
    }
}

/********/
/********/

// main.ts

import { Consumer } from './consumer.ts';

const consumer = new Consumer();
consumer.callMe(); // >> 'A thing'
```

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