From 8a204b8471d9fa51cb871f85d6fba84493b9ef10 Mon Sep 17 00:00:00 2001 From: michaelrhodes Date: Wed, 13 Jan 2016 11:28:10 -0800 Subject: [PATCH] Use is-buffer module to reduce bundle size. --- index.js | 4 ++-- package.json | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) 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" } }