Skip to content

Commit 0e5d823

Browse files
jimmywartingdcousens
authored andcommitted
standard --fix
1 parent e7aed16 commit 0e5d823

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

browser.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
// limit of Crypto.getRandomValues()
44
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
5-
var MAX_BYTES = 65536
5+
const MAX_BYTES = 65536
66

77
// Node supports requesting up to this number of bytes
88
// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
9-
var MAX_UINT32 = 4294967295
9+
const MAX_UINT32 = 4294967295
1010

1111
function oldBrowser () {
1212
throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
1313
}
1414

15-
var crypto = global.crypto || global.msCrypto
15+
const crypto = global.crypto || global.msCrypto
1616

1717
if (crypto && crypto.getRandomValues) {
1818
module.exports = randomBytes
@@ -24,12 +24,12 @@ function randomBytes (size, cb) {
2424
// phantomjs needs to throw
2525
if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')
2626

27-
var bytes = Buffer.allocUnsafe(size)
27+
const bytes = Buffer.allocUnsafe(size)
2828

29-
if (size > 0) { // getRandomValues fails on IE if size == 0
29+
if (size > 0) { // getRandomValues fails on IE if size == 0
3030
if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues
3131
// can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
32-
for (var generated = 0; generated < size; generated += MAX_BYTES) {
32+
for (let generated = 0; generated < size; generated += MAX_BYTES) {
3333
// buffer.slice automatically checks if the end is past the end of
3434
// the buffer so we don't have to here
3535
crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))

test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var test = require('tape')
2-
var randomBytes = require('./')
3-
var MAX_BYTES = 65536
4-
var MAX_UINT32 = 4294967295
1+
const test = require('tape')
2+
const randomBytes = require('./')
3+
const MAX_BYTES = 65536
4+
const MAX_UINT32 = 4294967295
55

66
test('sync', function (t) {
77
t.plan(9)

0 commit comments

Comments
 (0)