We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 80973e4 commit dedde6dCopy full SHA for dedde6d
lib/parser/utils.js
@@ -12,7 +12,15 @@ function normalizedFunctionString(fn) {
12
13
let randomBytes;
14
if (typeof window !== 'undefined') {
15
- randomBytes = size => window.crypto.getRandomValues(new Uint8Array(size));
+ if (window.crypto && window.crypto.getRandomValues) {
16
+ randomBytes = size => window.crypto.getRandomValues(new Uint8Array(size));
17
+ } else {
18
+ randomBytes = size => {
19
+ const result = new Uint8Array(size);
20
+ for (let i = 0; i < size; ++i) result[i] = Math.floor(Math.random() * 256);
21
+ return result;
22
+ };
23
+ }
24
} else {
25
randomBytes = require('crypto').randomBytes;
26
}
0 commit comments