Skip to content

Commit

Permalink
fixing uuid typescript error.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Jun 5, 2024
1 parent d72e70c commit 3775462
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/src/utils/uuid.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export function uuidV4(): string {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
// https://stackoverflow.com/questions/55853005/error-ts2365-operator-cannot-be-applied-to-types-number-and-1000
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
}

0 comments on commit 3775462

Please sign in to comment.