(self: UrlParams)
| 265 | * @category conversions |
| 266 | */ |
| 267 | export const toRecord = (self: UrlParams): Record<string, string | Arr.NonEmptyArray<string>> => { |
| 268 | const out: Record<string, string | Arr.NonEmptyArray<string>> = Object.create(null) |
| 269 | for (const [k, value] of self) { |
| 270 | const curr = out[k] |
| 271 | if (curr === undefined) { |
| 272 | out[k] = value |
| 273 | } else if (typeof curr === "string") { |
| 274 | out[k] = [curr, value] |
| 275 | } else { |
| 276 | curr.push(value) |
| 277 | } |
| 278 | } |
| 279 | return { ...out } |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * @since 1.0.0 |
no test coverage detected
searching dependent graphs…