MCPcopy Create free account
hub / github.com/reactnativecn/react-native-update / pickRandomEndpoint

Function pickRandomEndpoint

src/endpoint.ts:45–53  ·  view source on GitHub ↗
(
  endpoints: string[],
  random: () => number = Math.random,
)

Source from the content-addressed store, hash-verified

43};
44
45export const pickRandomEndpoint = (
46 endpoints: string[],
47 random: () => number = Math.random,
48) => {
49 if (!endpoints.length) {
50 throw new Error('No endpoints configured');
51 }
52 return endpoints[Math.floor(random() * endpoints.length)];
53};
54
55export async function selectFastestSuccessfulEndpoint<T>(
56 endpoints: string[],

Callers 1

executeEndpointFallbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected