Adding type checks to prevent errors resulting from assuming two object properties are of the same

type
This commit is contained in:
Evan Seguin 2015-05-07 11:49:41 -07:00
parent d225fa3d2b
commit effa9de53f
1 changed files with 4 additions and 2 deletions

View File

@ -27,9 +27,11 @@ module.exports = {
},
isSame: function (a, b) {
if (Array.isArray(a)) {
if (typeof a !== typeof b) {
return false;
} else if (Array.isArray(a)) {
return !this.arraysDiffer(a, b);
} else if (typeof a === 'object' && a !== null && a !== undefined) {
} else if (typeof a === 'object' && a !== null) {
return !this.objectsDiffer(a, b);
}