MCPcopy Index your code
hub / github.com/tinyhttp/tinyhttp / getURLParams

Function getURLParams

packages/url/src/index.ts:8–16  ·  view source on GitHub ↗
({ pattern, keys }: Regex, reqUrl = '/')

Source from the content-addressed store, hash-verified

6}
7
8export const getURLParams = ({ pattern, keys }: Regex, reqUrl = '/'): URLParams => {
9 const matches = pattern.exec(reqUrl)
10
11 const params = {}
12
13 if (matches) for (let i = 0; i < keys.length; i++) params[keys[i]] = matches[i + 1]
14
15 return params
16}
17
18export type URLParams = {
19 [key: string]: string

Callers 2

url.test.tsFile · 0.90
handleMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected