Skip to content

Commit 309eb98

Browse files
committed
Update dist packages
1 parent 64a4af9 commit 309eb98

3 files changed

Lines changed: 18 additions & 25 deletions

File tree

dist/index.esm.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,14 @@ function detectPrng() {
100100
}
101101
var browserCrypto = root && (root.crypto || root.msCrypto);
102102
if (browserCrypto) {
103-
try {
104-
return function () {
105-
var buffer = new Uint8Array(1);
106-
browserCrypto.getRandomValues(buffer);
107-
return buffer[0] / 0xff;
108-
};
109-
} catch (e) {}
103+
return function () {
104+
var buffer = new Uint8Array(1);
105+
browserCrypto.getRandomValues(buffer);
106+
return buffer[0] / 0xff;
107+
};
110108
} else {
111109
try {
112-
var nodeCrypto = require("crypto");
110+
var nodeCrypto = global["require"]("crypto");
113111
return function () {
114112
return nodeCrypto.randomBytes(1).readUInt8() / 0xff;
115113
};

dist/index.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,15 @@ export function detectPrng(allowInsecure = false, root) {
101101
}
102102
const browserCrypto = root && (root.crypto || root.msCrypto);
103103
if (browserCrypto) {
104-
try {
105-
return () => {
106-
const buffer = new Uint8Array(1);
107-
browserCrypto.getRandomValues(buffer);
108-
return buffer[0] / 0xff;
109-
};
110-
}
111-
catch (e) { }
104+
return () => {
105+
const buffer = new Uint8Array(1);
106+
browserCrypto.getRandomValues(buffer);
107+
return buffer[0] / 0xff;
108+
};
112109
}
113110
else {
114111
try {
115-
const nodeCrypto = require("crypto");
112+
const nodeCrypto = global["require"]("crypto");
116113
return () => nodeCrypto.randomBytes(1).readUInt8() / 0xff;
117114
}
118115
catch (e) { }

dist/index.umd.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,14 @@ function detectPrng() {
106106
}
107107
var browserCrypto = root && (root.crypto || root.msCrypto);
108108
if (browserCrypto) {
109-
try {
110-
return function () {
111-
var buffer = new Uint8Array(1);
112-
browserCrypto.getRandomValues(buffer);
113-
return buffer[0] / 0xff;
114-
};
115-
} catch (e) {}
109+
return function () {
110+
var buffer = new Uint8Array(1);
111+
browserCrypto.getRandomValues(buffer);
112+
return buffer[0] / 0xff;
113+
};
116114
} else {
117115
try {
118-
var nodeCrypto = require("crypto");
116+
var nodeCrypto = global["require"]("crypto");
119117
return function () {
120118
return nodeCrypto.randomBytes(1).readUInt8() / 0xff;
121119
};

0 commit comments

Comments
 (0)