{"name":"egg-validate","version":"1.1.2","description":"validate plugin for egg","eggPlugin":{"name":"validate"},"keywords":["egg","eggPlugin","egg-plugin","validate"],"dependencies":{"parameter":"^2.4.0"},"devDependencies":{"autod":"^3.0.1","egg":"^1.15.2","egg-bin":"^4.8.1","egg-ci":"^1.8.0","egg-mock":"^3.18.0","eslint":"^5.2.0","eslint-config-egg":"^7.0.0"},"engines":{"node":">=6.0.0"},"scripts":{"test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","lint":"eslint .","ci":"npm run lint && npm run cov","autod":"autod"},"ci":{"version":"6, 8, 10","license":true},"repository":{"type":"git","url":"git+https://github.com/eggjs/egg-validate.git"},"bugs":{"url":"https://github.com/eggjs/egg/issues"},"homepage":"https://github.com/eggjs/egg-validate#readme","author":{"name":"dead_horse"},"license":"MIT","readme":"# egg-validate\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-validate.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-validate\n[travis-image]: https://img.shields.io/travis/eggjs/egg-validate.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/egg-validate\n[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-validate.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/eggjs/egg-validate?branch=master\n[david-image]: https://img.shields.io/david/eggjs/egg-validate.svg?style=flat-square\n[david-url]: https://david-dm.org/eggjs/egg-validate\n[snyk-image]: https://snyk.io/test/npm/egg-validate/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-validate\n[download-image]: https://img.shields.io/npm/dm/egg-validate.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-validate\n\nValidate plugin for egg.\n\nSee [parameter](https://github.com/node-modules/parameter) for more information such as custom rule.\n\n## Install\n\n```bash\n$ npm i egg-validate --save\n```\n\n## Usage\n\n```js\n// config/plugin.js\nexports.validate = {\n  enable: true,\n  package: 'egg-validate',\n};\n```\n\n### Validate Request Body\n\n```js\n// app/controller/home.js\nexports.index = function* () {\n  this.validate({ id: 'id' }); // will throw if invalid\n  // or\n  const errors = this.validator.validate({ id: 'id' }, this.request.body);\n};\n```\n\n### Extend Rules\n\n- app.js\n\n```js\napp.validator.addRule('jsonString', (rule, value) => {\n  try {\n    JSON.parse(value);\n  } catch (err) {\n    return 'must be json string';\n  }\n});\n```\n\n## Questions & Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","gitHead":"dcdf88362c3893bb508457160ed9d92aa0887f29","_id":"egg-validate@1.1.2","_nodeVersion":"12.20.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-j42EFW8wzfAe+wQnEQyRBdVxeW+UMLrmW9n3/heyZkwfRYxhiXeJldD4QpGtS+xq1vnhyNu+uMXOymcxUirN/A==","shasum":"70b61cb1704397c01ec729d7522318867c7c2c41","tarball":"http://registry-npm.ywwl.com/egg-validate/download/egg-validate-1.1.2.tgz","fileCount":8,"unpackedSize":10555,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGwUaS6SyGk6JtoMk+pNEU1aOPUUPkfvDa+lwcFS7i/GAiAwGi0zTtrjrheWiTCBJRxvM58/bfAFkMJkf4TH8hJSRw=="}],"size":4218,"noattachment":false,"key":"/egg-validate/-/egg-validate-1.1.2.tgz"},"_npmUser":{"name":"hubcarl","email":"hubcarl@126.com"},"directories":{},"maintainers":[{"name":"eggjs-admin","email":"fengmk2+eggjs@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"atian25","email":"atian25@qq.com"},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"popomore","email":"sakura9515@gmail.com"},{"name":"wanghx","email":"whxaxes@gmail.com"},{"name":"hyj1991","email":"yeekwanvong@gmail.com"},{"name":"thonatos","email":"thonatos.yang@gmail.com"},{"name":"killagu","email":"killa07071201@gmail.com"},{"name":"coolme200","email":"2001-wms@163.com"},{"name":"xadillax","email":"admin@xcoder.in"},{"name":"ngot","email":"zhuanghengfei@gmail.com"},{"name":"mansonchor.zzw","email":"mansonchor1987@gmail.com"},{"name":"hubcarl","email":"hubcarl@126.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/egg-validate_1.1.2_1632819701561_0.6120809252769677"},"_hasShrinkwrap":false,"publish_time":1632819701684,"_cnpm_publish_time":1632819701684,"dist-tags":{"latest":"2.0.2","latest-1":"1.1.2"}}