( searchParams: URLSearchParams )
| 197 | } |
| 198 | |
| 199 | export function searchParamsToObject( |
| 200 | searchParams: URLSearchParams |
| 201 | ): Record<string, string | string[]> { |
| 202 | const output: Record<string, string | string[]> = {} |
| 203 | |
| 204 | for (const key of new Set(searchParams.keys())) { |
| 205 | const values = searchParams.getAll(key) |
| 206 | output[key] = values.length > 1 ? values : (values[0] ?? '') |
| 207 | } |
| 208 | |
| 209 | return output |
| 210 | } |
| 211 | |
| 212 | export function headersToObject(headers: Headers): Record<string, string> { |
| 213 | const output: Record<string, string> = {} |
no test coverage detected