{"_id":"egg-path-matching","_rev":"4633133","name":"egg-path-matching","description":"match or ignore url path","dist-tags":{"latest":"2.1.0","release-1.x":"1.2.0"},"maintainers":[{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"time":{"modified":"2026-04-10T19:01:56.000Z","created":"2016-11-15T06:21:21.347Z","1.2.0":"2025-01-22T14:52:39.792Z","2.1.0":"2024-09-18T13:53:10.895Z","2.0.0":"2024-06-15T15:30:48.816Z","1.1.0":"2023-12-14T09:29:49.101Z","1.0.1":"2017-11-15T03:59:28.838Z","1.0.0":"2016-11-15T06:21:21.347Z"},"users":{},"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"},"versions":{"1.2.0":{"name":"egg-path-matching","version":"1.2.0","engine":{"node":">= 4.0.0"},"description":"match or ignore url path","main":"index.js","scripts":{"pretest":"npm run lint -- --fix","test":"egg-bin test","cov":"egg-bin cov","lint":"eslint *.js test","preci":"npm run lint","ci":"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.9.0"},"devDependencies":{"egg-bin":"^6.5.2","eslint":"^8.55.0","eslint-config-egg":"12","path-to-regexp-v8":"npm:path-to-regexp@8"},"_id":"egg-path-matching@1.2.0","readmeFilename":"README.md","gitHead":"5f8082bdaaa3245502a4842807d38383f9e8e81e","bugs":{"url":"https://github.com/eggjs/egg-path-matching/issues"},"homepage":"https://github.com/eggjs/egg-path-matching#readme","_nodeVersion":"20.18.1","_npmVersion":"10.8.2","dist":{"shasum":"760bbde0ca8d638e2441b3f65fa8536a40a6b850","size":2637,"noattachment":false,"key":"/egg-path-matching/-/egg-path-matching-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/egg-path-matching/download/egg-path-matching-1.2.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-npm-production","tmp":"tmp/egg-path-matching_1.2.0_1737557559649_0.959310020605364"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-01-22T14:52:39.792Z","publish_time":1737557559792,"_source_registry_name":"default","_cnpm_publish_time":1737557559792},"2.1.0":{"name":"egg-path-matching","version":"2.1.0","engine":{"node":">= 18.19.0"},"description":"match or ignore url path","scripts":{"lint":"eslint src test","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","ci":"npm run lint && egg-bin cov && npm run prepublishOnly","prepublishOnly":"tshy && tshy-after"},"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":"^6.3.0"},"devDependencies":{"@eggjs/tsconfig":"1","@types/mocha":"10","@types/node":"20","egg-bin":"6","eslint":"8","eslint-config-egg":"13","tshy":"1","tshy-after":"1","typescript":"5"},"type":"module","tshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts"}},"exports":{"./package.json":"./package.json",".":{"import":{"source":"./src/index.ts","types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"source":"./src/index.ts","types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}}},"main":"./dist/commonjs/index.js","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","_id":"egg-path-matching@2.1.0","gitHead":"27189b556af05448979a94672d0a99a2c1f2ba82","bugs":{"url":"https://github.com/eggjs/egg-path-matching/issues"},"homepage":"https://github.com/eggjs/egg-path-matching#readme","_nodeVersion":"18.20.4","_npmVersion":"10.7.0","dist":{"shasum":"cfb3d0e55915094b9e7dcde1a7a9329385f22850","size":4401,"noattachment":false,"key":"/egg-path-matching/-/egg-path-matching-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/egg-path-matching/download/egg-path-matching-2.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_2.1.0_1726667590755_0.10843191039269162"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-09-18T13:53:10.895Z","publish_time":1726667590895,"_source_registry_name":"default","_cnpm_publish_time":1726667590895},"2.0.0":{"name":"egg-path-matching","version":"2.0.0","engine":{"node":">= 18.19.0"},"description":"match or ignore url path","scripts":{"lint":"eslint src test","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","ci":"npm run lint && egg-bin cov && npm run prepublishOnly","contributor":"git-contributor","prepublishOnly":"tshy && tshy-after"},"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":"^6.2.2"},"devDependencies":{"@eggjs/tsconfig":"1","@types/mocha":"10","@types/node":"20","egg-bin":"6","eslint":"8","eslint-config-egg":"13","git-contributor":"2","tshy":"1","tshy-after":"1","typescript":"5"},"type":"module","tshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts"}},"exports":{"./package.json":"./package.json",".":{"import":{"source":"./src/index.ts","types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"source":"./src/index.ts","types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}}},"main":"./dist/commonjs/index.js","types":"./dist/commonjs/index.d.ts","_id":"egg-path-matching@2.0.0","gitHead":"6a3fb78cfa5edaa9e024ccb797549d156f63a727","bugs":{"url":"https://github.com/eggjs/egg-path-matching/issues"},"homepage":"https://github.com/eggjs/egg-path-matching#readme","_nodeVersion":"18.20.3","_npmVersion":"10.7.0","dist":{"shasum":"64881ccbcdbf6758ded1eb180182d51df17a96e1","size":4644,"noattachment":false,"key":"/egg-path-matching/-/egg-path-matching-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/egg-path-matching/download/egg-path-matching-2.0.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_2.0.0_1718465448659_0.6106608737211643"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-06-15T15:30:48.816Z","publish_time":1718465448816,"_source_registry_name":"default","_cnpm_publish_time":1718465448816},"1.1.0":{"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":{"shasum":"5041ad86c14b489c28a6eca1cb349b76ef80e2f9","size":2573,"noattachment":false,"key":"/egg-path-matching/-/egg-path-matching-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/egg-path-matching/download/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,"_cnpmcore_publish_time":"2023-12-14T09:29:49.101Z","publish_time":1702546189101,"_source_registry_name":"default","_cnpm_publish_time":1702546189101},"1.0.1":{"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":{"shasum":"ccfc4e408acd1cf94a7f672fb8c969e456883913","size":2888,"noattachment":false,"key":"/egg-path-matching/-/egg-path-matching-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/egg-path-matching/download/egg-path-matching-1.0.1.tgz"},"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.0.1.tgz_1510718368747_0.2944866204634309"},"directories":{},"publish_time":1510718368838,"_cnpm_publish_time":1510718368838,"_hasShrinkwrap":false},"1.0.0":{"name":"egg-path-matching","version":"1.0.0","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":"f7d936b16d26fb16ea4e5af56f8ced729331f8ae","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.0","_shasum":"9c4c1b83056e2741705806e29907449b6d109c05","_from":".","_npmVersion":"3.10.3","_nodeVersion":"4.4.7","_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"dist":{"shasum":"9c4c1b83056e2741705806e29907449b6d109c05","size":2721,"noattachment":false,"key":"/egg-path-matching/-/egg-path-matching-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/egg-path-matching/download/egg-path-matching-1.0.0.tgz"},"maintainers":[{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/egg-path-matching-1.0.0.tgz_1479190879452_0.768738372484222"},"directories":{},"publish_time":1479190881347,"_cnpm_publish_time":1479190881347,"_hasShrinkwrap":false}},"readme":"# egg-path-matching\n\n[![NPM version][npm-image]][npm-url]\n[![CI](https://github.com/eggjs/egg-path-matching/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/egg-path-matching/actions/workflows/nodejs.yml)\n[![Test coverage](https://img.shields.io/codecov/c/github/eggjs/egg-path-matching.svg?style=flat-square)](https://codecov.io/gh/eggjs/egg-path-matching)\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-path-matching.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-path-matching\n[snyk-image]: https://snyk.io/test/npm/egg-path-matching/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-path-matching\n[download-image]: https://img.shields.io/npm/dm/egg-path-matching.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-path-matching\n\n## Installation\n\n```bash\nnpm install egg-path-matching\n```\n\n## Usage\n\n```ts\nimport { pathMatching } from 'egg-path-matching';\n\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.equal(match({ path: '/api' }), true);\nassert.equal(match({ path: '/api/hello' }), true);\nassert.equal(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.\nand if neither `ignore` nor `match` presented, the new function will always return `true`.\n\n### License\n\n[MIT](LICENSE)\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=eggjs/egg-path-matching)](https://github.com/eggjs/egg-path-matching/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","_attachments":{},"homepage":"https://github.com/eggjs/egg-path-matching#readme","bugs":{"url":"https://github.com/eggjs/egg-path-matching/issues"},"license":"MIT"}