Skip to content

Instantly share code, notes, and snippets.

@RidaRidss
Created June 22, 2021 08:12
Show Gist options
  • Save RidaRidss/dbc8179490ac8d7d7e0f8727887bf946 to your computer and use it in GitHub Desktop.
Save RidaRidss/dbc8179490ac8d7d7e0f8727887bf946 to your computer and use it in GitHub Desktop.
Universally Unique Identifier (UUID) Generator
import UUID_generator from "./UUID_generator";
const uniqueId = UUID_generator();
/*
***
***
**
*
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