mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Simplify _.isFunction.
This commit is contained in:
@@ -8697,12 +8697,13 @@
|
|||||||
* _.isFunction(/abc/);
|
* _.isFunction(/abc/);
|
||||||
* // => false
|
* // => 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
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||||
// in older versions of Chrome and Safari which return 'function' for regexes
|
// in older versions of Chrome and Safari which return 'function' for regexes
|
||||||
// and Safari 8 equivalents which return 'object' for typed array constructors.
|
// 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`.
|
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
||||||
|
|||||||
Reference in New Issue
Block a user