Skip to content

Commit

Permalink
feat(editor): replace old UUID generation with crypto.randomUUID
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed May 26, 2024
1 parent 793b5c4 commit cc8e211
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/editor/webview/uuid.ts
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit cc8e211

Please sign in to comment.