Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary typeof Buffer check #10

Merged
merged 1 commit into from Apr 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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