From cc8e211dadf8c448e2d033f95fe04b56c85df764 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Sun, 26 May 2024 09:28:18 +0800 Subject: [PATCH] feat(editor): replace old UUID generation with crypto.randomUUID --- src/editor/webview/uuid.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/editor/webview/uuid.ts b/src/editor/webview/uuid.ts index f02adb74..05c93a20 100644 --- a/src/editor/webview/uuid.ts +++ b/src/editor/webview/uuid.ts @@ -1,15 +1,5 @@ import crypto from "node:crypto"; -function oldUuid() { - let dt = new Date().getTime(); - const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - const r = (dt + Math.random() * 16) % 16 | 0; - dt = Math.floor(dt / 16); - return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); - }); - return uuid; -} - export function uuid(): string { return crypto.randomUUID(); } \ No newline at end of file