MCPcopy
hub / github.com/jwngr/sdow / getRandomWikipediaFact

Function getRandomWikipediaFact

website/src/utils.ts:23–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21
22let unusedWikipediaFacts: string[] = [];
23export const getRandomWikipediaFact = (): string => {
24 if (unusedWikipediaFacts.length === 0) {
25 unusedWikipediaFacts = clone(wikipediaFacts);
26 }
27
28 const indexToRemove = Math.floor(Math.random() * unusedWikipediaFacts.length);
29 return unusedWikipediaFacts.splice(indexToRemove, 1)[0];
30};
31
32export const getNumberWithCommas = (val: number): string => {
33 return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');

Callers 1

LoadingFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected