From 99564138e8c745f71f5842871c0a6ce30b26bde7 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Wed, 9 Dec 2009 11:17:30 -0500 Subject: [PATCH] added an extra check in isEqual to test for falsy against truthy values (so as to short circuit before trying to look for properties on null) --- underscore.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/underscore.js b/underscore.js index 51398635d..da098bc97 100644 --- a/underscore.js +++ b/underscore.js @@ -424,6 +424,8 @@ if (atype != btype) return false; // Basic equality test (watch out for coercions). if (a == b) return true; + // One is falsy and the other truthy. + if ((!a && b) || (a && !b)) return false; // One of them implements an isEqual()? if (a.isEqual) return a.isEqual(b); // Check dates' integer values.