MCPcopy Create free account
hub / github.com/dailydotdev/apps / getRandom4Digits

Function getRandom4Digits

packages/shared/src/lib/numberFormat.ts:23–31  ·  view source on GitHub ↗
(leftPad?: string)

Source from the content-addressed store, hash-verified

21}
22
23export const getRandom4Digits = (leftPad?: string): string => {
24 const random = Math.floor(1000 + Math.random() * 9000);
25
26 if (!leftPad) {
27 return random.toString();
28 }
29
30 return random.toString().padStart(4, leftPad);
31};
32
33export const removeNonNumber = (value: string): string =>
34 value.replace(/,(\d{2})$/, '.$1').replace(/[^\d.]/g, '');

Callers 1

useSquadCreateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected