MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / random

Function random

apps/start/src/utils/getDbId.ts:22–28  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

20 });
21
22 function random(str: string) {
23 const numbers = Math.floor(1000 + Math.random() * 9000);
24 if (str.match(/-\d{4}$/g)) {
25 return str.replace(/-\d{4}$/g, `-${numbers}`);
26 }
27 return `${str}-${numbers}`;
28 }
29
30 if (existingProject) {
31 return getId(tableName, random(name));

Callers 1

getIdFunction · 0.70

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected