{"_id":"@bjorkhaug/surl","name":"@bjorkhaug/surl","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@bjorkhaug/surl","version":"0.0.1","description":"Simple path segment router parsing for Deno, part of another module, but published separately for use in other projects.","license":"MIT","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","scope":"@bjorkhaug"},"repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/surl.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/surl/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"devDependencies":{"@types/node":"^18.11.9","picocolors":"^1.0.0","@deno/shim-deno":"~0.16.1"},"_id":"@bjorkhaug/surl@0.0.1","gitHead":"ddcad22e9b1b14dd8a2c9e19ce74ea2f4fe0ed11","types":"./script/mod.d.ts","homepage":"https://github.com/simenbjorkhaug/surl#readme","_nodeVersion":"21.2.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-+t+agYOwYQPSrmZolWJrGGdzkrIoDtUrXsA79yFkW9UKBwQ+DoHc8GaX0nOAYit+gufPtUrXTx2vpzK5tt4zfg==","shasum":"5495d834198644924698228881c4d9c79002458e","tarball":"https://registry.npmjs.org/@bjorkhaug/surl/-/surl-0.0.1.tgz","fileCount":40,"unpackedSize":12203,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFYTDhLo97w5/6WDuxkttY7jXKpQ25dPlTIRzqTwx+rXAiA9EOtTzBTJazhRtKKc1PKmWLAaDjcj7PZFASigXetz8Q=="}]},"_npmUser":{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"},"directories":{},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surl_0.0.1_1700215699496_0.10586174328216091"},"_hasShrinkwrap":false}},"time":{"created":"2023-11-17T10:08:19.391Z","0.0.1":"2023-11-17T10:08:19.740Z","modified":"2023-11-17T10:08:20.076Z"},"maintainers":[{"name":"simenbjorkhaug","email":"simen@bjorkhaug.io"}],"description":"Simple path segment router parsing for Deno, part of another module, but published separately for use in other projects.","homepage":"https://github.com/simenbjorkhaug/surl#readme","repository":{"type":"git","url":"git+https://github.com/simenbjorkhaug/surl.git"},"bugs":{"url":"https://github.com/simenbjorkhaug/surl/issues"},"license":"MIT","readme":"# @bjorkhaug/surl\n\nA simple path segment router parser for Deno, part of another module, but\npublished separately for use in other projects.\n\n## Usage\n\nThe `route` function is used to parse URL paths and extract parameters based on\na provided pattern. It returns a `Map` of parameter names to their values, or\n`null` if the URL does not match the pattern.\n\n```typescript\nimport { route } from 'npm:@bjorkhaug/surl'\n\nconst match = route(\n  '/users/{id:number}/{name}',\n  'https://localhost:3000/users/123/john',\n)\n\nif (match) {\n  console.log(match.get('id')) // Outputs: 123\n  console.log(match.get('name')) // Outputs: john\n}\n```\n\n## API\n\n`route(path: string, url: string | URL): Map<string, string | number | boolean | undefined> | null`\nParses the `url` based on the path pattern and returns a Map of parameter names\nto their values. If the `url` does not match the path pattern, it returns\n`null`.\n\nThe `path` pattern can include parameters in the format `{paramName:paramType}`,\nwhere `paramType` can be `string`, `number`, or `boolean`. If `paramType` is not\nprovided, it defaults to `string`.\n","readmeFilename":"README.md"}