Permalink
Cannot retrieve contributors at this time
25 lines (21 sloc)
927 Bytes
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/uuid/dist/commonjs-browser/rng.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
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.default = rng; | |
// Unique ID creation requires a high quality random # generator. In the browser we therefore | |
// require the crypto API and do not support built-in fallback to lower quality random number | |
// generators (like Math.random()). | |
let getRandomValues; | |
const rnds8 = new Uint8Array(16); | |
function rng() { | |
// lazy load so that environments that need to polyfill have a chance to do so | |
if (!getRandomValues) { | |
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. | |
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); | |
if (!getRandomValues) { | |
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); | |
} | |
} | |
return getRandomValues(rnds8); | |
} |