Last active
December 15, 2022 07:47
-
-
Save BrianHung/134988dd6749403d82ddd96da0a46c60 to your computer and use it in GitHub Desktop.
random uuid generator from https://github.com/tldraw/tldraw/blame/24cad6959f59f93e20e556d018c391fd89d4ecca/packages/core/src/utils/utils.ts#L1309
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
| function uniqueId(a = ''): string { | |
| return a | |
| ? /* eslint-disable no-bitwise */ | |
| ((Number(a) ^ (Math.random() * 16)) >> (Number(a) / 4)).toString(16) | |
| : `${1e7}-${1e3}-${4e3}-${8e3}-${1e11}`.replace(/[018]/g, uniqueId) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment