UNPKG

get-random-values-polypony

Version:

Synchronous randombytes function that works in node, the browser & react-native!

1 lines 471 B
const crypto=require("crypto"),isLegacyRandomFill=9>/^v(\d+)/.exec(process.version)[1],getRandomValues=crypto.randomFillSync?isLegacyRandomFill?require("./node-randomFillUint8.js"):require("./node-randomFill.js"):require("./node-randomBytes.js");getRandomValues.polyfill=function(){"crypto"in global||(global.crypto={}),"getRandomValues"in global.crypto||(global.crypto.getRandomValues=require("./browserLimitations.js")(getRandomValues))},module.exports=getRandomValues;