Created
May 27, 2019 09:47
-
-
Save simonkberg/56d8afab91a86a525b9a0039ed20e382 to your computer and use it in GitHub Desktop.
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
const uuid = () => { | |
const arr = new Uint32Array(8); | |
window.crypto.getRandomValues(arr); | |
return arr.reduce((acc, val, idx) => acc + (idx < 2 || idx > 5 ? '' : '-') + val.toString(16).slice(-4), ''); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment