From 5945dc8c1f0c92dfb42b930481735c9e4a5a15b1 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 18 Nov 2013 06:58:39 -0800 Subject: [PATCH] Require browsers to have `Uint8Array` support --- README.md | 2 +- index.js | 14 ++++---------- package.json | 4 +--- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6c8414a..b5789a3 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ It will also be loaded if you use the global `Buffer` variable. - Square-bracket `buf[4]` notation works! - Does not modify any browser prototypes. - All tests from the original `buffer-browserify` project pass. -- Works in browsers **without** `Uint8Array` support (IE9 and below) +- Requires browsers to have `Uint8Array` support (IE9 and up) ## How does it work? diff --git a/index.js b/index.js index 2e64c63..b86e93f 100644 --- a/index.js +++ b/index.js @@ -1,15 +1,9 @@ var assert -if (typeof Uint8Array === 'function') { - // Modern browser! - exports.Buffer = Buffer - exports.SlowBuffer = Buffer - exports.INSPECT_MAX_BYTES = 50 - Buffer.poolSize = 8192 -} else { - // Old browser :( - module.exports = require('buffer-browserify') -} +exports.Buffer = Buffer +exports.SlowBuffer = Buffer +exports.INSPECT_MAX_BYTES = 50 +Buffer.poolSize = 8192 // TODO: throw the correct exception type on errors (look at node source) diff --git a/package.json b/package.json index 57ebd74..5f6b2af 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,10 @@ "description": "buffer module compatibility for browserify (backed by ArrayBuffer so its fast!)", "main": "index.js", "dependencies": { - "base64-js": "0.0.4", - "buffer-browserify": "~0.2.2" + "base64-js": "0.0.4" }, "devDependencies": { "tape": "~2.1.0", - "tap": "~0.4.4", "benchmark": "~1.0.0", "browserify": "~2.35.4" }, -- 2.34.1