{"name":"@eggjs/path-matching","version":"3.0.2-beta.26","description":"match or ignore url path","keywords":["ignore","match","url"],"homepage":"https://github.com/eggjs/egg/tree/next/packages/path-matching","bugs":{"url":"https://github.com/eggjs/egg/issues"},"license":"MIT","author":{"name":"dead-horse","email":"dead_horse@qq.com","url":"http://deadhorse.me"},"repository":{"type":"git","url":"git+https://github.com/eggjs/egg.git","directory":"packages/path-matching"},"type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.js","./package.json":"./package.json"},"publishConfig":{"access":"public","exports":{".":"./dist/index.js","./package.json":"./package.json"}},"scripts":{"typecheck":"tsgo --noEmit"},"dependencies":{"path-to-regexp":"^6.3.0"},"devDependencies":{"@eggjs/tsconfig":"3.1.2-beta.26","@types/node":"^24.10.2","path-to-regexp-v8":"npm:path-to-regexp@^8.3.0","typescript":"^5.9.3"},"engines":{"node":">=22.18.0"},"readmeFilename":"README.md","gitHead":"2b18475d501defd6f3b7b2c42e02426c1c3e0f84","_id":"@eggjs/path-matching@3.0.2-beta.26","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-oinzSgK0YYARczuwRlyrLvRWH+fY6pfhmk/zEgDepwz6Hy8uz5LHSYkqVYAr4SwBNLeZK124YBOG1BueuiZo+Q==","shasum":"6415a6fd969ce5280f37919be0a59d98d53e38f7","tarball":"http://registry-npm.ywwl.com/@eggjs/path-matching/download/@eggjs/path-matching-3.0.2-beta.26.tgz","fileCount":5,"unpackedSize":6516,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@eggjs%2fpath-matching@3.0.2-beta.26","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGz0jYgdISe9HLx9dHWYf+AWCva+OokoCv3tzYZsFk1YAiEAkUgKYRmzdhHLWwgbkzhjcHF9kH7VNLCufiPBHdGOAcI="}],"size":2706,"noattachment":false,"key":"/@eggjs/path-matching/-/@eggjs/path-matching-3.0.2-beta.26.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:bf277220-9e49-45de-8ec0-ce6007108785"}},"directories":{},"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"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/path-matching_3.0.2-beta.26_1786086612970_0.053362452858218834"},"_hasShrinkwrap":false,"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":1786086613118,"_cnpm_publish_time":1786086613118,"dist-tags":{"beta":"3.0.2-beta.27","latest":"3.1.0","rc":"3.0.2-rc.1"}}