diff --git a/index.js b/index.js index 2f69ae0..8468a07 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -var Buffer = require('buffer').Buffer +var isBuffer = require('is-buffer') module.exports = function (buf) { // If the buffer is backed by a Uint8Array, a faster version will work @@ -12,7 +12,7 @@ module.exports = function (buf) { } } - if (Buffer.isBuffer(buf)) { + if (isBuffer(buf)) { // This is the slow version that will work with any Buffer // implementation (even in old browsers) var arrayCopy = new Uint8Array(buf.length) diff --git a/package.json b/package.json index fbfe6c0..a066b7b 100644 --- a/package.json +++ b/package.json @@ -30,5 +30,8 @@ "devDependencies": { "tape": "^4.4.0", "zuul": "^3.9.0" + }, + "dependencies": { + "is-buffer": "^1.1.1" } }