# koa-validator-middleware

> some validator middlewares for koa.

Latest version **0.0.6** (published 2017-11-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install koa-validator-middleware
pnpm add koa-validator-middleware
yarn add koa-validator-middleware
bun add koa-validator-middleware
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2017-11-22 |
| First published | 2017-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | miaowing |
| Maintainers | zfeng |
| Keywords | validador, koa-middleware, middleware, koa |

## Links

- npm: https://www.npmjs.com/package/koa-validator-middleware
- Repository: https://github.com/miaowing/koa-validator-middleware
- Homepage: https://github.com/miaowing/koa-validator-middleware#readme
- Issues: https://github.com/miaowing/koa-validator-middleware/issues
- npm.io page: https://npm.io/package/koa-validator-middleware

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4

## 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.0.6 (latest) — 2017-11-22
- 0.0.5 — 2017-06-07
- 0.0.4 — 2017-06-07
- 0.0.3 — 2017-06-07
- 0.0.2 — 2017-06-06
- 0.0.1 — 2017-06-06

## README

# koa-validator-middleware

A collection of validation middlewares for koa.

## Usage

```javascript
import {NotEmpty, Size} from 'koa-validator-middleware';
import KoaRouter from 'koa-router';

const router = new KoaRouter();

router.post('/users', 
    NotEmpty('request.body.username'), 
    Size('request.body.password', 6, 20), 
    function (ctx) {
        if(!ctx.validation.pass) {
            console.log(ctx.validation.errors);
            console.log(ctx.validation.error.username);
            console.log(ctx.validation.error.password);
        }
    }
);
```

## API

### NotEmpty(path)

### NotInteger(path)

### NotNumber(path)

### NotNull(path)

### Min(path, min)

### Max(path, max)

### Size(path, min, max)

### Pattern(path, regExp)

### Default(path, defaultValue)

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