Simplify _.isFunction.

This commit is contained in:
jdalton
2015-05-26 11:49:39 -07:00
parent 6bcbb6f7bb
commit 722eac1681

View File

@@ -8697,12 +8697,13 @@
* _.isFunction(/abc/);
* // => false
*/
var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) {
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in older versions of Chrome and Safari which return 'function' for regexes
// and Safari 8 equivalents which return 'object' for typed array constructors.
return objToString.call(value) == funcTag;
};
var type = typeof value;
return type == 'function' || (type == 'object' && objToString.call(value) == funcTag);
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.