From 81c9dc2f1fdd324846ddaa0c0fe255be114f91e6 Mon Sep 17 00:00:00 2001 From: Kevin Malakoff Date: Thu, 6 Oct 2011 18:23:42 +0200 Subject: [PATCH] yuchi spotted duplication --- underscore.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/underscore.js b/underscore.js index 610533673..73ffa58ce 100644 --- a/underscore.js +++ b/underscore.js @@ -641,9 +641,9 @@ // Unwrap any wrapped objects. if (a._chain) a = a._wrapped; if (b._chain) b = b._wrapped; - // One of them implements an isEqual() - if (a.isEqual) return a.isEqual(b); - if (b.isEqual) return b.isEqual(a); + // Invoke a custom `isEqual` method if one is provided. + if (_.isFunction(a.isEqual)) return a.isEqual(b); + if (_.isFunction(b.isEqual)) return b.isEqual(a); // Compare object types. var typeA = typeof a; if (typeA != typeof b) return false; @@ -675,8 +675,6 @@ } // Ensure that both values are objects. if (typeA != 'object') return false; - // Invoke a custom `isEqual` method if one is provided. - if (_.isFunction(a.isEqual)) return a.isEqual(b); // Assume equality for cyclic structures. The algorithm for detecting cyclic structures is // adapted from ES 5.1 section 15.12.3, abstract operation `JO`. var length = stack.length;