We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f3741e commit b942fa4Copy full SHA for b942fa4
src/utils/idGenerator.js
src/utils/uuid.js
@@ -0,0 +1,17 @@
1
+/**
2
+* By w3resource, 2020, https://www.w3resource.com/javascript-exercises/javascript-math-exercise-23.php
3
+*/
4
+
5
+export function generateUUID(){
6
+ var dt = new Date().getTime();
7
8
+ var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
9
+ var r = (dt + Math.random()*16)%16 | 0;
10
+ dt = Math.floor(dt/16);
11
+ return (c === "x" ? r :(r&0x3|0x8)).toString(16);
12
+ });
13
14
+ uuid = "t" + uuid.substring(1, uuid.length); // CSS does not work correctly with classes starting with a numeric character
15
16
+ return uuid;
17
+}
0 commit comments