{"name":"egg-path-matching","version":"1.1.0","description":"match or ignore url path","main":"index.js","scripts":{"test":"egg-bin test","cov":"egg-bin cov","lint":"eslint *.js test","ci":"npm run lint && npm run cov","contributor":"git-contributor"},"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":{"egg-bin":"^6.5.2","eslint":"^8.55.0","eslint-config-egg":"^13.0.0","git-contributor":"^2.1.5"},"engine":{"node":">= 4.0.0"},"_id":"egg-path-matching@1.1.0","gitHead":"bb9c8e328d9c76e1f9cc63e2ad5eaf3e19bed307","bugs":{"url":"https://github.com/eggjs/egg-path-matching/issues"},"homepage":"https://github.com/eggjs/egg-path-matching#readme","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-pHdz/q8v843jSEpLksXmJEZ8dzDNiCfTgQtgoSTT9bsLa1QFCzsdeZLag+CKTaCHsDhy3id/WjjTRF94X91y6w==","shasum":"5041ad86c14b489c28a6eca1cb349b76ef80e2f9","tarball":"http://registry-npm.ywwl.com/egg-path-matching/download/egg-path-matching-1.1.0.tgz","fileCount":4,"unpackedSize":5881,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/egg-path-matching@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHIPpaAQzH981fAKZFcuB1wD20h5ReOPMuyE3QjInkv3AiEA5fqZJmC9YLxl4J+yFiKMFFTeg3dTDQ3zfg7pJE8+oUo="}],"size":2573,"noattachment":false,"key":"/egg-path-matching/-/egg-path-matching-1.1.0.tgz"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"maintainers":[{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/egg-path-matching_1.1.0_1702546188970_0.613618947930086"},"_hasShrinkwrap":false,"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":1702546189101,"_cnpm_publish_time":1702546189101,"dist-tags":{"latest":"2.1.0","release-1.x":"1.2.0"}}