# egg-validate2

> 基于async-validate开发的，方面的校验插件

Latest version **1.1.2** (published 2021-04-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install egg-validate2
pnpm add egg-validate2
yarn add egg-validate2
bun add egg-validate2
```

## 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.1.2 |
| Published | 2021-04-17 |
| First published | 2021-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 2 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | ron_dong |
| Maintainers | ron_dong |
| Keywords | egg, eggPlugin, egg-plugin |

## Links

- npm: https://www.npmjs.com/package/egg-validate2
- Repository: https://github.com/Ron-Dong/egg-validate2
- Homepage: https://github.com/Ron-Dong/egg-validate2#readme
- Issues: https://github.com/Ron-Dong/egg-validate2/issues
- npm.io page: https://npm.io/package/egg-validate2

## Dependencies (2)

- [custom-id](https://npm.io/package/custom-id.md) ^1.2.0
- [async-validator](https://npm.io/package/async-validator.md) ^3.5.1

## Recent versions

- 1.1.2 (latest) — 2021-04-17
- 1.1.1 — 2021-04-16
- 1.1.0 — 2021-04-16
- 1.0.13 — 2021-04-15
- 1.0.12 — 2021-04-15
- 1.0.11 — 2021-04-15
- 1.0.10 — 2021-04-15
- 1.0.9 — 2021-04-15
- 1.0.8 — 2021-04-15
- 1.0.7 — 2021-04-15
- 1.0.6 — 2021-04-15
- 1.0.5 — 2021-04-15
- 1.0.4 — 2021-04-15
- 1.0.3 — 2021-04-15
- 1.0.2 — 2021-04-15
- … 2 more at https://npm.io/package/egg-validate2/versions

## README

# egg-validate2

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/egg-validate2.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-validate2
[travis-image]: https://img.shields.io/travis/eggjs/egg-validate2.svg?style=flat-square
[travis-url]: https://travis-ci.org/eggjs/egg-validate2
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-validate2.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/egg-validate2?branch=master
[david-image]: https://img.shields.io/david/eggjs/egg-validate2.svg?style=flat-square
[david-url]: https://david-dm.org/eggjs/egg-validate2
[snyk-image]: https://snyk.io/test/npm/egg-validate2/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-validate2
[download-image]: https://img.shields.io/npm/dm/egg-validate2.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-validate2

<!--
Description here.
-->

## Install

```bash
$ npm i egg-validate2 --save
```

## Usage

```js
// {app_root}/config/plugin.js
exports.validate = {
  enable: true,
  package: 'egg-validate2',
};
```

## Configuration

```js
// {app_root}/config/config.default.js
exports.validate = {
};
```

see [config/config.default.js](config/config.default.js) for more detail.

## Example

<!-- example here -->
```js
'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
    async index() {
        const { ctx } = this;

        await ctx.validator().validate({title: [{required: true, message: 'title is required!'}]},ctx.request.query);

        ctx.body = 'hi, egg';
    }
}

module.exports = HomeController;

```

See [async-validator](https://github.com/tmpfs/async-validate) for more information such as custom rule.

## Questions & Suggestions

Please open an issue [here](https://github.com/eggjs/egg/issues).

## License

[MIT](LICENSE)

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