{"name":"@eggjs/path-matching","version":"3.0.2-beta.24","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.24","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":"elrrrrrrr","email":"elrrrrrrr@gmail.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":"c8de6a3cdb66793da5b022bb64454cfbf78e7950","tarball":"http://registry-npm.ywwl.com/@eggjs/path-matching/download/@eggjs/path-matching-3.0.2-beta.24.tgz","fileCount":5,"integrity":"sha512-B/zlbh7wD353t2RdZGsFhUDy3hh5kArJjqO9yggJ8gB1WcJlNe9fvsYTn5Iwstjl65dJBfb8N6emJoLDRyuHfQ==","signatures":[{"sig":"MEQCICxs2zGBJRMDAEqVmOJhLbrZ0BFt0Ti58P8aMLQM0XNsAiAJ0vd/QHUnKEFFtj6qLTUgetEIIe6kFDdy+7nNVWDD1Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eggjs%2fpath-matching@3.0.2-beta.24","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":6516,"size":2706,"noattachment":false,"key":"/@eggjs/path-matching/-/@eggjs/path-matching-3.0.2-beta.24.tgz"},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22.18.0"},"exports":{".":"./dist/index.js","./package.json":"./package.json"},"gitHead":"1e9757ea83e6846b8458bde0f2b1b9fde5f5e0ef","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"}},"repository":{"url":"git+https://github.com/eggjs/egg.git","type":"git","directory":"packages/path-matching"},"_npmVersion":"11.16.0","description":"match or ignore url path","directories":{},"_nodeVersion":"24.18.0","dependencies":{"path-to-regexp":"^6.3.0"},"publishConfig":{"access":"public","exports":{".":"./dist/index.js","./package.json":"./package.json"}},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^5.9.3","@types/node":"^24.10.2","@eggjs/tsconfig":"3.1.2-beta.24","path-to-regexp-v8":"npm:path-to-regexp@^8.3.0"},"_npmOperationalInternal":{"tmp":"tmp/path-matching_3.0.2-beta.24_1783867563881_0.04922061222011287","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":1783867564024,"_cnpm_publish_time":1783867564024,"dist-tags":{"beta":"3.0.2-beta.27","latest":"3.1.0","rc":"3.0.2-rc.1"}}