Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 3ef2dd5

Browse files
authored
feat(uuid): change to crypto module
1 parent bfb0e5e commit 3ef2dd5

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

src/modules/uuid.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,7 @@ module.exports = function uuid(number) {
1717
let i = 0;
1818

1919
do {
20-
var d = new Date().getTime();
21-
22-
let uuid = "xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx".replace(
23-
/[x]/g,
24-
function (c) {
25-
var r = Math.random() * 16;
26-
27-
r = (d + r) % 16 | 0;
28-
d = Math.floor(d / 16);
29-
30-
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
31-
}
32-
);
20+
const uuid = require("crypto").randomUUID();
3321

3422
uuids.push(uuid);
3523

0 commit comments

Comments
 (0)