From 3d93ed9059ef5b3be16e2407ffdab82a6d80863d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 2 Jun 2014 08:08:35 -0700 Subject: [PATCH] Fix failing tests in Safari > 5. --- lodash.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lodash.js b/lodash.js index bb70bf786..3672b15fe 100644 --- a/lodash.js +++ b/lodash.js @@ -64,6 +64,9 @@ /** Used to detect hexadecimal string values */ var reHexPrefix = /^0[xX]/; + /** Used to detect host constructors (Safari > 5) */ + var reHostCtor = /^\[object .+?Constructor\]$/; + /** Used to match latin-1 supplement letters */ var reLatin1 = /[\xC0-\xFF]/g; @@ -2518,7 +2521,10 @@ * @returns {boolean} Returns `true` if `value` is a native function, else `false`. */ function isNative(value) { - return typeof value == 'function' && reNative.test(fnToString.call(value)); + var type = typeof value; + return type == 'function' + ? reNative.test(fnToString.call(value)) + : (value && type == 'object' && reHostCtor.test(toString.call(value))) || false; } /**