{"name":"@eggjs/path-matching","version":"3.0.2-beta.17","keywords":["ignore","match","url"],"author":{"url":"http://deadhorse.me","name":"dead-horse","email":"dead_horse@qq.com"},"license":"MIT","_id":"@eggjs/path-matching@3.0.2-beta.17","maintainers":[{"name":"gxkl","email":"gxkl203@gmail.com"},{"name":"eggjs-admin","email":"fengmk2+eggjs@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"atian25","email":"atian25@qq.com"},{"name":"hyj1991","email":"yeekwanvong@gmail.com"},{"name":"killagu","email":"killa07071201@gmail.com"},{"name":"coolme200","email":"2001-wms@163.com"},{"name":"akitasummer","email":"644171127@qq.com"},{"name":"niania","email":"ljracm@gmail.com"}],"homepage":"https://github.com/eggjs/egg/tree/next/packages/path-matching","bugs":{"url":"https://github.com/eggjs/egg/issues"},"dist":{"shasum":"da77469cbc135257f6ddb552751c49253a6fd436","tarball":"http://registry-npm.ywwl.com/@eggjs/path-matching/download/@eggjs/path-matching-3.0.2-beta.17.tgz","fileCount":5,"integrity":"sha512-/flOzoK8V0TDEprsF1TfLqg8iE7N2eqXg5M1LZ+Yt/iI8B8G7cO88K0wpwP79PJFIHH+uvYFkaFmMToBB4upvg==","signatures":[{"sig":"MEUCIQDczjEjsehCUQqWKzrBNVoqHvzdikxiWt7YsOoc+cnQ9AIgZfZ/sCHwE1x2tPgEVNic5g8u7lKVm2tk5p1oc68MMkY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eggjs%2fpath-matching@3.0.2-beta.17","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":6420,"size":2708,"noattachment":false,"key":"/@eggjs/path-matching/-/@eggjs/path-matching-3.0.2-beta.17.tgz"},"main":"./dist/index.js","type":"module","_from":"file:eggjs-path-matching-3.0.2-beta.17.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22.18.0"},"exports":{".":"./dist/index.js","./package.json":"./package.json"},"scripts":{"typecheck":"tsgo --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:bf277220-9e49-45de-8ec0-ce6007108785"}},"_resolved":"/tmp/3fa69aee715ca459b4de464d8b67ee0f/eggjs-path-matching-3.0.2-beta.17.tgz","_integrity":"sha512-/flOzoK8V0TDEprsF1TfLqg8iE7N2eqXg5M1LZ+Yt/iI8B8G7cO88K0wpwP79PJFIHH+uvYFkaFmMToBB4upvg==","repository":{"url":"git+https://github.com/eggjs/egg.git","type":"git","directory":"packages/path-matching"},"_npmVersion":"11.13.0","description":"match or ignore url path","directories":{},"_nodeVersion":"24.17.0","dependencies":{"path-to-regexp":"^6.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^5.9.3","@types/node":"^24.10.2","@eggjs/tsconfig":"3.1.2-beta.17","path-to-regexp-v8":"npm:path-to-regexp@^8.3.0"},"_npmOperationalInternal":{"tmp":"tmp/path-matching_3.0.2-beta.17_1782607299070_0.241400389818341","host":"s3://npm-registry-packages-npm-production"},"readme":"# @eggjs/path-matching\n\n[![NPM version][npm-image]][npm-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/@eggjs/path-matching.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@eggjs/path-matching\n[snyk-image]: https://snyk.io/test/npm/@eggjs/path-matching/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/@eggjs/path-matching/badge.svg?style=flat-square\n[download-image]: https://img.shields.io/npm/dm/@eggjs/path-matching.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@eggjs/path-matching\n\n## Installation\n\n```bash\nnpm install @eggjs/path-matching\n```\n\n## Usage\n\n```ts\nimport { pathMatching } from '@eggjs/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  // custom path-to-regexp module, default is `path-to-regexp@6`\n  // pathToRegexpModule: customPathToRegexp,\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- `pathToRegexpModule` {Object | Function} - custom path-to-regexp module. Default is `path-to-regexp@6`. Supports both `path-to-regexp@6` and `path-to-regexp@8+` formats.\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)](https://github.com/eggjs/egg/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","publish_time":1782607299241,"_cnpm_publish_time":1782607299241,"dist-tags":{"beta":"3.0.2-beta.27","latest":"3.1.0","rc":"3.0.2-rc.1"}}