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 3775462 commit d1ae42d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions js/src/utils/uuid.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export function uuidV4(): string {
// 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 =>
// @ts-ignore
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
}

0 comments on commit d1ae42d

Please sign in to comment.