From 8f06ea259a2690c893b513c336bca57f533037e8 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 10 Oct 2016 10:30:01 -0700 Subject: [PATCH] Tweak exit early in `_.isFunction`. --- lodash.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lodash.js b/lodash.js index 1660fbb09..8e7919acd 100644 --- a/lodash.js +++ b/lodash.js @@ -11638,9 +11638,12 @@ * // => false */ function isFunction(value) { + if (!isObject(value)) { + return false; + } // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed array and other constructors. - var tag = isObject(value) ? baseGetTag(value) : ''; + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == proxyTag; }