From 722eac1681b1d03b68889cc3e8df8dd745073858 Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 26 May 2015 11:49:39 -0700 Subject: [PATCH] Simplify `_.isFunction`. --- lodash.src.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index cec9e8829..939d1b9ee 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -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`.