(query: LocationQuery)
| 366 | * @returns a record with string arrays. |
| 367 | */ |
| 368 | export const parseLocationQuery = (query: LocationQuery): Record<string, string[]> => { |
| 369 | const result: Record<string, string[]> = {}; |
| 370 | |
| 371 | for (const key in query) { |
| 372 | if (typeof query[key] === 'string' && query[key] !== '') { |
| 373 | result[key] = [query[key] as string]; |
| 374 | } else if (Array.isArray(query[key]) && query[key]?.length) { |
| 375 | result[key] = compactArray<string>(query[key] as LocationQueryValue[], { |
| 376 | removeEmptyStrings: true, |
| 377 | }); |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | return result; |
| 382 | }; |
| 383 | |
| 384 | /** |
| 385 | * Parses a value to a BigInt or returns undefined if the value is not a valid BigInt. |
no test coverage detected