{"name":"egg-path-matching","version":"1.0.1","description":"match or ignore url path","main":"index.js","scripts":{"test":"egg-bin test --require intelli-espower-loader","autod":"autod","cov":"egg-bin cov --require intelli-espower-loader","lint":"eslint index.js test","ci":"npm run lint && npm run cov"},"keywords":["url","match","ignore"],"author":{"name":"dead-horse","email":"dead_horse@qq.com","url":"http://deadhorse.me"},"repository":{"type":"git","url":"git+ssh://git@github.com/eggjs/egg-path-matching.git"},"license":"MIT","dependencies":{"path-to-regexp":"^1.7.0"},"devDependencies":{"autod":"^2.7.1","egg-bin":"^1.7.0","eslint":"^3.10.1","eslint-config-egg":"^3.2.0","intelli-espower-loader":"^1.0.1","power-assert":"^1.4.2"},"engine":{"node":">=4"},"ci":{"version":"4,5,6"},"gitHead":"840c1f9228780f42d12b875013988107c93e9328","bugs":{"url":"https://github.com/eggjs/egg-path-matching/issues"},"homepage":"https://github.com/eggjs/egg-path-matching#readme","_id":"egg-path-matching@1.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.9.0","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"integrity":"sha512-XhwWldfhbjKvdDE9kUA6ywxgcxcLFHNaNKP1VZAE9oYTcKGB+piEn99R18zZWvBbk7eXXKHcxT1PQYpqu9GR7A==","shasum":"ccfc4e408acd1cf94a7f672fb8c969e456883913","tarball":"http://registry-npm.ywwl.com/egg-path-matching/download/egg-path-matching-1.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAv+4CTS5JxuLMi2jcsN7LxUatq8VZftiM7R1M+jVZtJAiEA0l2kLy76z1GbEr2SsZpkJ0iZb39qhbIsZNC3j3OSdWQ="}],"size":2888,"noattachment":false,"key":"/egg-path-matching/-/egg-path-matching-1.0.1.tgz"},"maintainers":[{"email":"fengmk2@gmail.com","name":"fengmk2"},{"email":"dead_horse@qq.com","name":"dead_horse"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/egg-path-matching-1.0.1.tgz_1510718368747_0.2944866204634309"},"directories":{},"readme":"egg-path-matching\n---------------\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-path-matching.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-path-matching\n[travis-image]: https://img.shields.io/travis/eggjs/egg-path-matching.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/egg-path-matching\n[coveralls-image]: https://img.shields.io/coveralls/eggjs/egg-path-matching.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/eggjs/egg-path-matching?branch=master\n\n## Installation\n\n```bash\n$ npm install egg-path-matching\n```\n\n## Usage\n\n```js\nconst pathMatching = require('egg-path-matching');\nconst options = {\n  ignore: '/api', // string will use parsed by path-to-regexp\n  // support regexp\n  ignore: /^\\/api/,\n  // support function\n  ignore: ctx => ctx.path.startsWith('/api'),\n  // support Array\n  ignore: [ ctx => ctx.path.startsWith('/api'), /^\\/foo$/, '/bar'],\n  // support match or ignore\n  match: '/api',\n};\n\nconst match = pathMatching(options);\nassert(match({ path: '/api' }) === true);\nassert(match({ path: '/api/hello' }) === true);\nassert(match({ path: '/api' }) === true);\n```\n\n### options\n\n- `match` {String | RegExp | Function | Array} - if request path hit `options.match`, will return true, otherwise will return false.\n- `ignore` {String | RegExp | Function | Array} - if request path hit `options.ignore`, will return false, otherwise will return true.\n\n`ignore` and `match` can not both be presented. and if neither `ignore` nor `match` presented, the new function will always return true.\n\n### License\n\n[MIT](LICENSE)\n<!-- GITCONTRIBUTOR_START -->\n\n## Contributors\n\n|[<img src=\"https://avatars.githubusercontent.com/u/985607?v=4\" width=\"100px;\"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/156269?v=4\" width=\"100px;\"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/7903541?v=4\" width=\"100px;\"/><br/><sub><b>releasethecow</b></sub>](https://github.com/releasethecow)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/227713?v=4\" width=\"100px;\"/><br/><sub><b>atian25</b></sub>](https://github.com/atian25)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/5102113?v=4\" width=\"100px;\"/><br/><sub><b>xyeric</b></sub>](https://github.com/xyeric)<br/>|\n| :---: | :---: | :---: | :---: | :---: |\n\n\nThis project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Thu Dec 14 2023 17:20:14 GMT+0800`.\n\n<!-- GITCONTRIBUTOR_END -->","publish_time":1510718368838,"_cnpm_publish_time":1510718368838,"dist-tags":{"latest":"2.1.0","release-1.x":"1.2.0"}}