Created
April 5, 2023 14:12
-
-
Save SebastianUdden/53bc1c015a30ca4264f31d447fb73cf9 to your computer and use it in GitHub Desktop.
Create ID
This file contains hidden or 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
| const uuidv4 = () => | |
| "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (x) => { | |
| const random = (Math.random() * 16) | 0; | |
| const value = x === "x" ? random : (random & 0x3) | 0x8; | |
| return value.toString(16); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment