{"_id":"path-to-regexp@9.0.0","bugs":{"url":"https://github.com/pillarjs/path-to-regexp/issues"},"dist":{"shasum":"f6b516e6b5dbfbe9034a6fc1289bc687b26b70c7","tarball":"http://registry-npm.ywwl.com/path-to-regexp/download/path-to-regexp-9.0.0.tgz","integrity":"sha512-kfo5HIFCfEH24bcHSWEFIfrwiCsm/DXR+j1fc0696VIdWkICdAcKH2LxRClvz5HQcG4iCQpb4qBZ7pttGPG/dA==","fileCount":6,"unpackedSize":60461,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/path-to-regexp@9.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDzLkTmAhjb3VCQuNJiaR+OvIem69RKrTdPsIJ4riaxAQIgNXgvcFQqrhKgh6ofoJ6+Ohoq4DloLxdKwUdQ2WZr60o="}],"size":15467,"noattachment":false,"key":"/path-to-regexp/-/path-to-regexp-9.0.0.tgz"},"main":"dist/index.js","name":"path-to-regexp","type":"module","exports":"./dist/index.js","funding":{"url":"https://opencollective.com/express","type":"opencollective"},"gitHead":"32292b9d13239c7fa3ed23e89c59c10264f9fe20","license":"MIT","scripts":{"lint":"ts-scripts lint","size":"size-limit","test":"ts-scripts test && npm run size","bench":"vitest bench","build":"ts-scripts build","specs":"ts-scripts specs","format":"ts-scripts format","prepare":"ts-scripts install && npm run build"},"typings":"dist/index.d.ts","version":"9.0.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"c481de43-f6a4-4428-919a-512df3e3ab6a"},"approver":{"name":"blakeembrey","email":"hello@blakeembrey.com"}},"homepage":"https://github.com/pillarjs/path-to-regexp#readme","keywords":["express","regexp","route","routing"],"repository":{"url":"git+https://github.com/pillarjs/path-to-regexp.git","type":"git"},"size-limit":[{"path":"dist/index.js","limit":"2 kB"}],"ts-scripts":{"dist":["dist"],"project":["tsconfig.build.json"]},"_npmVersion":"11.20.0","description":"Express style path to RegExp utility","directories":{},"maintainers":[{"name":"ulisesgascon","email":"ulisesgascondev@gmail.com"},{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"jonathanong","email":"jonathanrichardong@gmail.com"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"defunctzombie","email":"shtylman@gmail.com"}],"_nodeVersion":"26.12.1","publishConfig":{"access":"public"},"devDependencies":{"vitest":"^5.0.5","recheck":"^4.5.0","size-limit":"^14.2.0","typescript":"^7.0.2","@types/node":"^26.6.5","@types/semver":"^7.8.0","@vitest/coverage-v8":"^5.0.5","@borderless/ts-scripts":"^0.15.0","@size-limit/preset-small-lib":"^14.2.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/path-to-regexp_9.0.0_1792693336486_0.2990532405506583"},"_hasShrinkwrap":false,"readme":"# Path-to-RegExp\n\n> Turn a path string such as `/user/:name` into a regular expression.\n\n[![NPM version][npm-image]][npm-url]\n[![NPM downloads][downloads-image]][downloads-url]\n[![Build status][build-image]][build-url]\n[![Build coverage][coverage-image]][coverage-url]\n[![License][license-image]][license-url]\n\n## Installation\n\n```\nnpm install path-to-regexp --save\n```\n\n## Usage\n\n```js\nimport { match, pathToRegexp, compile, parse, stringify } from \"path-to-regexp\";\n```\n\n### Parameters\n\nParameters match arbitrary strings in a path by matching up to the end of the segment, or up to any proceeding tokens. They are defined by prefixing a colon to the parameter name (`:foo`). Parameter names can use any valid JavaScript identifier, or be double quoted to use other characters (`:\"param-name\"`).\n\n```js\nconst fn = match(\"/:foo/:bar\");\n\nfn(\"/test/route\");\n//=> { path: '/test/route', params: { foo: 'test', bar: 'route' } }\n```\n\n### Wildcard\n\nWildcard parameters match one or more characters across multiple segments. They are defined the same way as regular parameters, but are prefixed with an asterisk (`*foo`).\n\n```js\nconst fn = match(\"/*splat\");\n\nfn(\"/bar/baz\");\n//=> { path: '/bar/baz', params: { splat: [ 'bar', 'baz' ] } }\n```\n\n### Optional\n\nBraces can be used to define parts of the path that are optional.\n\n```js\nconst fn = match(\"/users{/:id}/delete\");\n\nfn(\"/users/delete\");\n//=> { path: '/users/delete', params: {} }\n\nfn(\"/users/123/delete\");\n//=> { path: '/users/123/delete', params: { id: '123' } }\n```\n\n## Match\n\nThe `match` function returns a function for matching strings against a path:\n\n- **path** String, `TokenData` object, or array of strings and `TokenData` objects.\n- **options** _(optional)_ (Extends [pathToRegexp](#pathToRegexp) options)\n  - **decode** Function for decoding strings to params, or `false` to disable all processing. (default: `decodeURIComponent`)\n\n```js\nconst fn = match(\"/foo/:bar\");\n```\n\n**Please note:** `path-to-regexp` is intended for ordered data (e.g. paths, hosts). It can not handle arbitrarily ordered data (e.g. query strings, URL fragments, JSON, etc).\n\n## PathToRegexp\n\nThe `pathToRegexp` function returns the `regexp` for matching strings against paths, and an array of `keys` for understanding the `RegExp#exec` matches.\n\n- **path** String, `TokenData` object, or array of strings and `TokenData` objects.\n- **options** _(optional)_ (See [parse](#parse) for more options)\n  - **sensitive** Regexp will be case sensitive. (default: `false`)\n  - **end** Validate the match reaches the end of the string. (default: `true`)\n  - **delimiter** The default delimiter for segments, e.g. `[^/]` for `:named` parameters. (default: `'/'`)\n  - **trailing** Allows optional trailing delimiter to match. (default: `true`)\n\n```js\nconst { regexp, keys } = pathToRegexp(\"/foo/:bar\");\n\nregexp.exec(\"/foo/123\"); //=> [\"/foo/123\", \"123\"]\n```\n\n## Compile (\"Reverse\" Path-To-RegExp)\n\nThe `compile` function will return a function for transforming parameters into a valid path:\n\n- **path** A string or `TokenData` object.\n- **options** (See [parse](#parse) for more options)\n  - **delimiter** The default delimiter for segments, e.g. `[^/]` for `:named` parameters. (default: `'/'`)\n  - **encode** Function for encoding input strings for output into the path, or `false` to disable entirely. (default: `encodeURIComponent`)\n\n```js\nconst toPath = compile(\"/user/:id\");\n\ntoPath({ id: \"name\" }); //=> \"/user/name\"\ntoPath({ id: \"café\" }); //=> \"/user/caf%C3%A9\"\n\nconst toPathRepeated = compile(\"/*segment\");\n\ntoPathRepeated({ segment: [\"foo\"] }); //=> \"/foo\"\ntoPathRepeated({ segment: [\"a\", \"b\", \"c\"] }); //=> \"/a/b/c\"\n\n// When disabling `encode`, you need to make sure inputs are encoded correctly. No arrays are accepted.\nconst toPathRaw = compile(\"/user/:id\", { encode: false });\n\ntoPathRaw({ id: \"%3A%2F\" }); //=> \"/user/%3A%2F\"\n```\n\n## Stringify\n\nTransform a `TokenData` object to a Path-to-RegExp string.\n\n- **data** A `TokenData` object.\n\n```js\nconst data = {\n  tokens: [\n    { type: \"text\", value: \"/\" },\n    { type: \"param\", name: \"foo\" },\n  ],\n};\n\nconst path = stringify(data); //=> \"/:foo\"\n```\n\n## Developers\n\n- If you are rewriting paths with match and compile, consider using `encode: false` and `decode: false` to keep raw paths passed around.\n- To ensure matches work on paths containing characters usually encoded, such as emoji, consider using [encodeurl](https://github.com/pillarjs/encodeurl) for `encodePath`.\n\n### Parse\n\nThe `parse` function accepts a string and returns `TokenData`, which can be used with `match` and `compile`.\n\n- **path** A string.\n- **options** _(optional)_\n  - **encodePath** A function for encoding input strings. (default: `x => x`, recommended: [`encodeurl`](https://github.com/pillarjs/encodeurl))\n\n### Tokens\n\n`TokenData` has two properties:\n\n- **tokens** A sequence of tokens, currently of types `text`, `param`, `wildcard`, or `group`.\n- **originalPath** The original path used with `parse`, shown in error messages to assist debugging.\n\n### Custom path\n\nIn some applications you may not be able to use the `path-to-regexp` syntax, but you still want to use this library for `match` and `compile`. For example:\n\n```js\nimport { match } from \"path-to-regexp\";\n\nconst tokens = [\n  { type: \"text\", value: \"/\" },\n  { type: \"param\", name: \"foo\" },\n];\nconst originalPath = \"/[foo]\"; // To help debug error messages.\nconst path = { tokens, originalPath };\nconst fn = match(path);\n\nfn(\"/test\"); //=> { path: '/test', params: { foo: 'test' } }\n```\n\n## Errors\n\nAn effort has been made to ensure ambiguous paths from previous releases throw an error. This means you might be seeing an error when things worked before.\n\n### Missing parameter name\n\nParameter names must be provided after `:` or `*`, for example `/*path`. They can be valid JavaScript identifiers (e.g. `:myName`) or JSON strings (`:\"my-name\"`).\n\n### Unexpected `?` or `+`\n\nIn past releases, `?`, `*`, and `+` were used to denote optional or repeating parameters. As an alternative, try these:\n\n- For optional (`?`), use braces: `/file{.:ext}`.\n- For one or more (`+`), use a wildcard: `/*path`.\n- For zero or more (`*`), use both: `/files{/*path}`.\n\n### Unexpected `(`, `)`, `[`, `]`, etc.\n\nPrevious versions of Path-to-RegExp used these for RegExp features. This version no longer supports them so they've been reserved to avoid ambiguity. To match these characters literally, escape them with a backslash, e.g. `\"\\\\(\"`.\n\n### Unterminated quote\n\nParameter names can be wrapped in double quote characters, and this error means you forgot to close the quote character. For example, `:\"foo`.\n\n### Express <= 4.x\n\nPath-To-RegExp breaks compatibility with Express <= `4.x` in the following ways:\n\n- The wildcard `*` must have a name and matches the behavior of parameters `:`.\n- The optional character `?` is no longer supported, use braces instead: `/:file{.:ext}`.\n- Regexp characters are not supported.\n- Some characters have been reserved to avoid confusion during upgrade (`()[]?+!`).\n- Parameter names now support valid JavaScript identifiers, or quoted like `:\"this\"`.\n\n## License\n\nMIT\n\n[npm-image]: https://img.shields.io/npm/v/path-to-regexp\n[npm-url]: https://npmjs.org/package/path-to-regexp\n[downloads-image]: https://img.shields.io/npm/dm/path-to-regexp\n[downloads-url]: https://npmjs.org/package/path-to-regexp\n[build-image]: https://img.shields.io/github/actions/workflow/status/pillarjs/path-to-regexp/ci.yml?branch=master\n[build-url]: https://github.com/pillarjs/path-to-regexp/actions/workflows/ci.yml?query=branch%3Amaster\n[coverage-image]: https://img.shields.io/codecov/c/gh/pillarjs/path-to-regexp\n[coverage-url]: https://codecov.io/gh/pillarjs/path-to-regexp\n[license-image]: http://img.shields.io/npm/l/path-to-regexp.svg?style=flat\n[license-url]: LICENSE.md\n","publish_time":1792693336576,"_cnpm_publish_time":1792693336576,"dist-tags":{"express":"0.1.13","latest":"9.0.0","old":"6.3.0"}}