2 * Determine if an object is a Buffer
4 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
8 // The _isBuffer check is for Safari 5-7 support, because it's missing
9 // Object.prototype.constructor. Remove this eventually
10 module.exports = function (obj) {
11 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
14 function isBuffer (obj) {
15 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
18 // For Node v0.10 support. Remove this eventually.
19 function isSlowBuffer (obj) {
20 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))