{"name":"@eggjs/path-matching","version":"3.0.2-beta.1","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.1","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"}],"homepage":"https://github.com/eggjs/egg/tree/next/packages/path-matching","bugs":{"url":"https://github.com/eggjs/egg/issues"},"dist":{"shasum":"2c33bda0763eea5ac2a3ba6f750e2c1cb2dfdcb8","tarball":"http://registry-npm.ywwl.com/@eggjs/path-matching/download/@eggjs/path-matching-3.0.2-beta.1.tgz","fileCount":5,"integrity":"sha512-KobuFdd7WT/agyI7PZq/T4HKcckJH/rulSIqvnRZFv0HeFTePcvzDFJ4srp2kSbZSCOxSaQqp9IfhCiGxtruQw==","signatures":[{"sig":"MEQCIHQ5jsXlVyg9XiTRx7NlvVU2feKuXc/QJAMFWxGyaZ5DAiBs1FsxLpN4J6rHf7k8j2me2251CeIrBvHjxtPo1+DnTg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eggjs%2fpath-matching@3.0.2-beta.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":6414,"size":2714,"noattachment":false,"key":"/@eggjs/path-matching/-/@eggjs/path-matching-3.0.2-beta.1.tgz"},"main":"./dist/index.js","type":"module","_from":"file:eggjs-path-matching-3.0.2-beta.1.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/a612dcb260f8d6a2f1b79b6886070fa3/eggjs-path-matching-3.0.2-beta.1.tgz","_integrity":"sha512-KobuFdd7WT/agyI7PZq/T4HKcckJH/rulSIqvnRZFv0HeFTePcvzDFJ4srp2kSbZSCOxSaQqp9IfhCiGxtruQw==","repository":{"url":"git+https://github.com/eggjs/egg.git","type":"git","directory":"packages/path-matching"},"_npmVersion":"11.8.0","description":"match or ignore url path","directories":{},"_nodeVersion":"24.13.1","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.1","path-to-regexp-v8":"npm:path-to-regexp@^8.3.0"},"_npmOperationalInternal":{"tmp":"tmp/path-matching_3.0.2-beta.1_1772119396767_0.4594728880118677","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":1772119396913,"_cnpm_publish_time":1772119396913,"dist-tags":{"beta":"3.0.2-beta.27","latest":"3.1.0","rc":"3.0.2-rc.1"}}