Skip to content

Commit

Permalink
Merge pull request #10 from ksheedlo/unrequire-buffer
Browse files Browse the repository at this point in the history
Remove unnecessary typeof Buffer check
  • Loading branch information
jonschlinkert committed Apr 25, 2017
2 parents 2a83cac + 0cfb70e commit 10265f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
30 changes: 17 additions & 13 deletions browser.js
Expand Up @@ -62,7 +62,7 @@ module.exports = function kindOf(val) {
}

// buffer
if (typeof Buffer !== 'undefined' && isBuffer(val)) {
if (isBuffer(val)) {
return 'buffer';
}

Expand Down Expand Up @@ -117,22 +117,26 @@ module.exports = function kindOf(val) {
};

},{"is-buffer":2}],2:[function(require,module,exports){
/**
* Determine if an object is Buffer
*
* Author: Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* License: MIT
/*!
* Determine if an object is a Buffer
*
* `npm install is-buffer`
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/

// The _isBuffer check is for Safari 5-7 support, because it's missing
// Object.prototype.constructor. Remove this eventually
module.exports = function (obj) {
return !!(obj != null &&
(obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)
(obj.constructor &&
typeof obj.constructor.isBuffer === 'function' &&
obj.constructor.isBuffer(obj))
))
return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
}

function isBuffer (obj) {
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
}

// For Node v0.10 support. Remove this eventually.
function isSlowBuffer (obj) {
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
}

},{}]},{},[1])(1)
Expand Down
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -61,7 +61,7 @@ module.exports = function kindOf(val) {
}

// buffer
if (typeof Buffer !== 'undefined' && isBuffer(val)) {
if (isBuffer(val)) {
return 'buffer';
}

Expand Down

0 comments on commit 10265f9

Please sign in to comment.