# sfn-validate-decorator

> A decorator function for SFN controllers to validate inputs.

Latest version **0.1.0** (published 2018-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install sfn-validate-decorator
pnpm add sfn-validate-decorator
yarn add sfn-validate-decorator
bun add sfn-validate-decorator
```

## 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.0 |
| Published | 2018-09-23 |
| First published | 2018-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ayon Lee |
| Maintainers | hyurl |
| Keywords | sfn, validate, decorator |

## Links

- npm: https://www.npmjs.com/package/sfn-validate-decorator
- Repository: https://github.com/hyurl/sfn-validate-decorator
- Homepage: https://github.com/hyurl/sfn-validate-decorator#readme
- Issues: https://github.com/hyurl/sfn-validate-decorator/issues
- npm.io page: https://npm.io/package/sfn-validate-decorator

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.10
- [sfn-validator](https://npm.io/package/sfn-validator.md) ^0.1.5
- [function-intercepter](https://npm.io/package/function-intercepter.md) ^0.1.3

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2018-09-23

## README

# sfn-validate-decorator

**A decorator function for SFN controllers to validate inputs.**

This package currently supports only HttpControllers, since WebSocket way to 
transmit data is somewhat different and cannot be tracked by the current version
of SFN.

## Install

```sh
npm i sfn-validate-decorator
```

## Example

```typescript
import { HttpController } from "sfn";
import { validate } from "sfn-validate-decorator";

export default class extends HttpController {
    @validate("req.body", {
        username: {
            type: "string",
            required: true,
            length: [3, 18]
        },
        password: {
            type: "string",
            required: true,
            length: [3, 18]
        }
    })
    async register() {
        // ...
    }
}
```

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