From 036612e7d6cc5760313a8850a2751a5e95184eab Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Sat, 5 Aug 2017 23:35:51 -0400 Subject: [PATCH] Reduce bundle size --- format.js | 2 +- package.json | 2 +- random-browser.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/format.js b/format.js index 4c0f0d53..746202a3 100644 --- a/format.js +++ b/format.js @@ -24,7 +24,7 @@ * @name format */ module.exports = function (random, alphabet, size) { - var step = Math.ceil(1.2 * 256 / alphabet.length * size) + var step = Math.ceil(310 / alphabet.length * size) var bytes, byte var id = '' diff --git a/package.json b/package.json index 7b40c03b..fc960c4b 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "size-limit": [ { "path": "index.js", - "limit": "320 B" + "limit": "260 B" } ], "lint-staged": { diff --git a/random-browser.js b/random-browser.js index b2cfff83..f7fbd11d 100644 --- a/random-browser.js +++ b/random-browser.js @@ -1,4 +1,4 @@ -var crypto = global.crypto || global.msCrypto +var crypto = window.crypto || window.msCrypto module.exports = function (bytes) { return crypto.getRandomValues(new Uint8Array(bytes))