( baseUrl: string, path: string, query?: Record<string, string | number | boolean | string[] | null | undefined> )
| 269 | * value. Array values are appended as repeated parameters. |
| 270 | */ |
| 271 | export function buildVantaUrl( |
| 272 | baseUrl: string, |
| 273 | path: string, |
| 274 | query?: Record<string, string | number | boolean | string[] | null | undefined> |
| 275 | ): string { |
| 276 | const url = new URL(`${baseUrl}/v1${path}`) |
| 277 | if (query) { |
| 278 | for (const [key, value] of Object.entries(query)) { |
| 279 | if (value == null || value === '') continue |
| 280 | if (Array.isArray(value)) { |
| 281 | for (const entry of value) { |
| 282 | url.searchParams.append(key, entry) |
| 283 | } |
| 284 | } else { |
| 285 | url.searchParams.set(key, String(value)) |
| 286 | } |
| 287 | } |
| 288 | } |
| 289 | return url.toString() |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Splits a comma-separated filter value into trimmed entries, returning |
no test coverage detected