( url: string | null, )
| 28 | |
| 29 | // a function that accept a url and return params as an object |
| 30 | export function getUrlParameters( |
| 31 | url: string | null, |
| 32 | ): { [k: string]: string } | null { |
| 33 | if (url === null) { |
| 34 | return null; |
| 35 | } |
| 36 | const regex = /[?&]([^=#]+)=([^&#]*)/g; |
| 37 | const params = {}; |
| 38 | let match; |
| 39 | while ((match = regex.exec(url))) { |
| 40 | if (match[1] !== null) { |
| 41 | // @ts-expect-error - Dynamic key assignment |
| 42 | params[match[1]] = match[2]; |
| 43 | } |
| 44 | } |
| 45 | return params; |
| 46 | } |
| 47 | |
| 48 | export const getPreviousPageParam: GetNextPageParamFunction< |
| 49 | unknown, |
no outgoing calls
no test coverage detected