# @cubos/utils

> ## inject() e create()

Latest version **0.1.3** (published 2023-06-29) · 0 weekly downloads

## Install

```sh
npm install @cubos/utils
pnpm add @cubos/utils
yarn add @cubos/utils
bun add @cubos/utils
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2023-06-29 |
| First published | 2023-03-08 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 2 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lbguilherme |

## Links

- npm: https://www.npmjs.com/package/@cubos/utils
- npm.io page: https://npm.io/package/@cubos/utils

## Dependencies (2)

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

## Recent versions

- 0.1.3 (latest) — 2023-06-29
- 0.1.2 — 2023-03-14
- 0.1.1 — 2023-03-13
- 0.1.0 — 2023-03-08

## README

# @cubos/utils

## inject() e create()

Funções que auxiliam a injeção de dependência de um serviço com vários providers com o tsyringe:

```typescript

  // utilize isso no entrypoint da aplicação
  inject(
    create(Logger).using(MongoDB).getDependency({ uri: env.MONGO_LOGGER_URL }),
    create(SMS).using(SNS).getDependency({ ... }),
  );

  const logger = container.resolve(Logger);

  logger instanceof Logger // false;
  logger instanceof MongoDB // true

  const sms = container.resolve(SMS);

  sms instanceof SMS // false;
  sms instanceof SNS // true
```

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