({ pattern, keys }: Regex, reqUrl = '/')
| 6 | } |
| 7 | |
| 8 | export 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 | |
| 18 | export type URLParams = { |
| 19 | [key: string]: string |
no outgoing calls
no test coverage detected