(path: string, query: Record<string, string>)
| 6 | * @param query - Object style query parameters to add |
| 7 | */ |
| 8 | export function addQueryToPath(path: string, query: Record<string, string>): string { |
| 9 | const queryParams = new URLSearchParams(path.split('?')[1] || ''); |
| 10 | |
| 11 | for (const [key, value] of Object.entries(query)) { |
| 12 | queryParams.set(key, value); |
| 13 | } |
| 14 | |
| 15 | return path.split('?')[0] + '?' + queryParams; |
| 16 | } |
no test coverage detected