# nestjs-create-param-decorator-with-injections

> A function that extends `createParamDecorator` function of `nestjs` by receiving an object of injections that will be provided to the handler function of the decorator.

Latest version **0.1.2** (published 2023-07-17) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install nestjs-create-param-decorator-with-injections
pnpm add nestjs-create-param-decorator-with-injections
yarn add nestjs-create-param-decorator-with-injections
bun add nestjs-create-param-decorator-with-injections
```

## 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.1.2 |
| Published | 2023-07-17 |
| First published | 2022-07-08 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 32.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Tarık İnce |
| Maintainers | incetarik |
| Keywords | nestjs, createParamDecorator, service, injection |

## Links

- npm: https://www.npmjs.com/package/nestjs-create-param-decorator-with-injections
- Repository: https://github.com/incetarik/nestjs-create-param-decorator-with-injections
- Homepage: https://github.com/incetarik/nestjs-create-param-decorator-with-injections#readme
- Issues: https://github.com/incetarik/nestjs-create-param-decorator-with-injections/issues
- npm.io page: https://npm.io/package/nestjs-create-param-decorator-with-injections

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2023-07-17
- 0.1.1 — 2022-07-08

## README

# nestjs-create-param-decorator-with-injections

A library providing service injections through an object that will be used in
the `createParamDecorator` like function.

# Example
```ts
import { createParamDecoratorWithInjections } from 'nestjs-create-param-decorator-with-injections'

const UserSettings = createParamDecoratorWithInjections(async (_data, _ctx, { user, db }) => {
  const settings = await db.settings.where({ owner: user })
  return settings
}, { user: UserService, db: DatabaseService }) // Services to inject

@Injectable()
class AppService {
  getUserTheme(@UserSettings() settings: UserSettings) {
    return settings
  }
}
```

The `createParamDecoratorWithInjections` function is very similar to
`createParamDecorator` but the function it takes also have the two more
arguments where the third argument is providing the services that are injected
and the fourth one contains extra data such as the initial data passed to the
decorator.

# Support
To support the project, you can send donations to following addresses:

```md
- Bitcoin     : bc1qtut2ss8udkr68p6k6axd0na6nhvngm5dqlyhtn
- Bitcoin Cash: qzmmv43ztae0tfsjx8zf4wwnq3uk6k7zzgcfr9jruk
- Ether       : 0xf542BED91d0218D9c195286e660da2275EF8eC84
```

---
_Source: https://npm.io/package/nestjs-create-param-decorator-with-injections · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
