Fixed isEqual if second object has isEqual implemented and added isObject method

This commit is contained in:
Dmitry Baranovskiy
2011-06-07 09:48:34 +10:00
parent cf6cc16f43
commit 42487bf47d
2 changed files with 23 additions and 0 deletions

View File

@@ -600,6 +600,7 @@
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);
// Check dates' integer values.
if (_.isDate(a) && _.isDate(b)) return a.getTime() === b.getTime();
// Both are NaN?
@@ -641,6 +642,11 @@
return toString.call(obj) === '[object Array]';
};
// Is a given variable an object?
_.isObject = function(obj) {
return obj === Object(obj);
};
// Is a given variable an arguments object?
_.isArguments = function(obj) {
return !!(obj && hasOwnProperty.call(obj, 'callee'));