Created
June 22, 2021 08:12
-
-
Save RidaRidss/dbc8179490ac8d7d7e0f8727887bf946 to your computer and use it in GitHub Desktop.
Universally Unique Identifier (UUID) Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UUID_generator from "./UUID_generator"; | |
const uniqueId = UUID_generator(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
*** | |
*** | |
** | |
* | |
A unique identifier (UID) is an identifier that marks that particular record as unique from every other record. | |
It allows the record to be referenced in the Summon Index without confusion or unintentional overwriting from other records. | |
*** | |
*** | |
** | |
* | |
*/ | |
export default function () { | |
function chr4() { | |
return Math.random().toString(16).slice(-4); | |
} | |
return chr4() + chr4() + | |
'-' + chr4() + | |
'-' + chr4() + | |
'-' + chr4() + | |
'-' + chr4() + chr4() + chr4(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment