# teys-injector

> very simple injector for Typescript code to simplify and speed up code production

Latest version **1.0.5** (published 2022-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install teys-injector
pnpm add teys-injector
yarn add teys-injector
bun add teys-injector
```

## 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.5 |
| Published | 2022-10-24 |
| First published | 2018-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 19.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pierre Teyssedre |
| Maintainers | pteyssedre |
| Keywords | typescript, ioc, simple, teyssedre.ca |

## Links

- npm: https://www.npmjs.com/package/teys-injector
- Repository: https://github.com/pteyssedre/teys-injector
- Homepage: https://github.com/pteyssedre/teys-injector#readme
- Issues: https://github.com/pteyssedre/teys-injector/issues
- npm.io page: https://npm.io/package/teys-injector

## Dependencies (2)

- [typescript](https://npm.io/package/typescript.md) ^4.6.3
- [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

- 1.0.5 (latest) — 2022-10-24
- 1.0.4 — 2022-04-24
- 1.0.3 — 2019-02-17
- 1.0.2 — 2019-02-17
- 1.0.1 — 2018-10-27
- 1.0.0 — 2018-10-26

## README

# teys-injector
Simple injector syntax for Typescript code. It allows you to set dependency

```typescript
import { Injectable, Inject } from "teys-injector";

@Injectable()
class Service {
    
    method1(): boolean {
        return false;
    }
}
```

```typescript
import { Inject } from "teys-injector";

class OtherClass {
    
    @Inject()
    svc: Service;
    
    method2() {
        return this.svc.method1();
    }
}
```

You can also register manually values and resolve them
```typescript
import { Injector } from "teys-injector";

Injector.Register("user", { username: 'default' });
```

```typescript
import { Injector } from "teys-injector";

const defaultUser = Injector.Resolve<User>("user");

```

## Not supported yet

 - Injectable constructor parameters

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