generateUuid.ts 251 B

1234567
  1. export const generateUuid = () =>
  2. /* eslint-disable no-bitwise, eqeqeq */
  3. "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
  4. const r = (Math.random() * 16) | 0;
  5. const v = c == "x" ? r : (r & 0x3) | 0x8;
  6. return v.toString(16);
  7. });