File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ function getCrypto(): CryptoInternal | undefined {
2323
2424let 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 ( / [ 0 1 8 ] / g, c =>
You can’t perform that action at this time.
0 commit comments