From eb61c9ee9dd246f91a74707d610577373efaa229 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Fri, 13 Sep 2024 15:31:26 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=B7=B2=E7=BB=8F=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E5=88=B0common?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/utils/uuid.ts | 42 --------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 apps/web-antd/src/utils/uuid.ts diff --git a/apps/web-antd/src/utils/uuid.ts b/apps/web-antd/src/utils/uuid.ts deleted file mode 100644 index 81c49a09..00000000 --- a/apps/web-antd/src/utils/uuid.ts +++ /dev/null @@ -1,42 +0,0 @@ -const hexList: string[] = []; -for (let i = 0; i <= 15; i++) { - hexList[i] = i.toString(16); -} - -export function buildUUID(): string { - let uuid = ''; - for (let i = 1; i <= 36; i++) { - switch (i) { - case 9: - case 14: - case 19: - case 24: { - uuid += '-'; - - break; - } - case 15: { - uuid += 4; - - break; - } - case 20: { - uuid += hexList[(Math.random() * 4) | 8]; - - break; - } - default: { - uuid += hexList[Math.trunc(Math.random() * 16)]; - } - } - } - return uuid.replaceAll('-', ''); -} - -let unique = 0; -export function buildShortUUID(prefix = ''): string { - const time = Date.now(); - const random = Math.floor(Math.random() * 1_000_000_000); - unique++; - return `${prefix}_${random}${unique}${String(time)}`; -}