Permalink
Cannot retrieve contributors at this time
43 lines (43 sloc)
1.21 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/@azure/core-util/dist-esm/src/uuidUtils.native.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) Microsoft Corporation. | |
// Licensed under the MIT license. | |
/* | |
* NOTE: When moving this file, please update "react-native" section in package.json. | |
*/ | |
/** | |
* Generated Universally Unique Identifier | |
* | |
* @returns RFC4122 v4 UUID. | |
*/ | |
export function generateUUID() { | |
let uuid = ""; | |
for (let i = 0; i < 32; i++) { | |
// Generate a random number between 0 and 15 | |
const randomNumber = Math.floor(Math.random() * 16); | |
// Set the UUID version to 4 in the 13th position | |
if (i === 12) { | |
uuid += "4"; | |
} | |
else if (i === 16) { | |
// Set the UUID variant to "10" in the 17th position | |
uuid += (randomNumber & 0x3) | 0x8; | |
} | |
else { | |
// Add a random hexadecimal digit to the UUID string | |
uuid += randomNumber.toString(16); | |
} | |
// Add hyphens to the UUID string at the appropriate positions | |
if (i === 7 || i === 11 || i === 15 || i === 19) { | |
uuid += "-"; | |
} | |
} | |
return uuid; | |
} | |
/** | |
* Generated Universally Unique Identifier | |
* | |
* @returns RFC4122 v4 UUID. | |
*/ | |
export function randomUUID() { | |
return generateUUID(); | |
} | |
//# sourceMappingURL=uuidUtils.native.js.map |