( endpoints: Array<string | null | undefined>, )
| 26 | }; |
| 27 | |
| 28 | export const dedupeEndpoints = ( |
| 29 | endpoints: Array<string | null | undefined>, |
| 30 | ): string[] => { |
| 31 | const result: string[] = []; |
| 32 | const visited = new Set<string>(); |
| 33 | |
| 34 | for (const endpoint of endpoints) { |
| 35 | if (!endpoint || visited.has(endpoint)) { |
| 36 | continue; |
| 37 | } |
| 38 | visited.add(endpoint); |
| 39 | result.push(endpoint); |
| 40 | } |
| 41 | |
| 42 | return result; |
| 43 | }; |
| 44 | |
| 45 | export const pickRandomEndpoint = ( |
| 46 | endpoints: string[], |
no outgoing calls
no test coverage detected