Skip to content

Commit 4ae3991

Browse files
committed
More
1 parent 2e898a4 commit 4ae3991

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/utils/misc.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ function getCrypto(): CryptoInternal | undefined {
2323

2424
let emptyUuid: string | undefined;
2525

26+
function getRandomByte(): number {
27+
return Math.random() * 16;
28+
}
29+
2630
/**
2731
* UUID4 generator
2832
* @param crypto Object that provides the crypto API.
@@ -38,12 +42,10 @@ export function uuid4(crypto = getCrypto()): string {
3842
// https://github.com/getsentry/sentry-javascript/issues/8935
3943
}
4044

41-
const getRandomByte = (): number => Math.random() * 16;
42-
4345
if (!emptyUuid) {
4446
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
4547
// Concatenating the following numbers as strings results in '10000000100040008000100000000000'
46-
emptyUuid = (([1e7] as unknown as string) + 1e3 + 4e3 + 8e3 + 1e11);
48+
emptyUuid = ([1e7] as unknown as string) + 1e3 + 4e3 + 8e3 + 1e11;
4749
}
4850

4951
return emptyUuid.replace(/[018]/g, c =>

0 commit comments

Comments
 (0)