Skip to content

Commit

Permalink
Use is-buffer instead of Buffer.isBuffer
Browse files Browse the repository at this point in the history
The is-buffer module checks if an object is a Buffer without causing
Webpack or Browserify to include the whole Buffer module in the bundle.
  • Loading branch information
fgnass committed May 4, 2017
1 parent f31317a commit c82753c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
11 changes: 1 addition & 10 deletions lib/utils.js
@@ -1,6 +1,7 @@
'use strict';

var bind = require('./helpers/bind');
var isBuffer = require('is-buffer');

/*global toString:true*/

Expand All @@ -18,16 +19,6 @@ function isArray(val) {
return toString.call(val) === '[object Array]';
}

/**
* Determine if a value is a Node Buffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Node Buffer, otherwise false
*/
function isBuffer(val) {
return ((typeof Buffer !== 'undefined') && (Buffer.isBuffer) && (Buffer.isBuffer(val)));
}

/**
* Determine if a value is an ArrayBuffer
*
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -72,6 +72,7 @@
},
"typings": "./index.d.ts",
"dependencies": {
"follow-redirects": "^1.2.3"
"follow-redirects": "^1.2.3",
"is-buffer": "^1.1.5"
}
}

0 comments on commit c82753c

Please sign in to comment.