Skip to content

Commit

Permalink
Adding is-buffer util thanks to @mvanaltvorst PR, see: axios#2375
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanLafferty committed Aug 26, 2019
1 parent 2ee3b48 commit a3635bd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/utils.js
Expand Up @@ -9,6 +9,16 @@ var isBuffer = require('is-buffer');

var toString = Object.prototype.toString;

/**
* Determine if an object is a buffer
* @param {Object} obj The object to test
* @returns {boolean} True if the object is a buffer, otherwise false
*/
function isBuffer (obj) {
return obj != null && obj.constructor != null &&
typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
}

/**
* Determine if a value is an Array
*
Expand Down

0 comments on commit a3635bd

Please sign in to comment.