From 7f59e4089a80f3d086ba81846d40fed9c4871189 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Sat, 16 May 2015 20:14:04 -0400 Subject: [PATCH] Optimize _.isEqual for primatives https://github.com/jashkenas/backbone/pull/3605#issuecomment-102657781 --- underscore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/underscore.js b/underscore.js index 1efa346b5..cc1aaf450 100644 --- a/underscore.js +++ b/underscore.js @@ -1203,7 +1203,7 @@ // Perform a deep comparison to check if two objects are equal. _.isEqual = function(a, b) { - return eq(a, b); + return a === a && a !== 0 && typeof a !== 'object' && typeof b !== 'object' ? a === b : eq(a, b); }; // Is a given array, string, or object empty?