Adding type checks to prevent errors resulting from assuming two object properties are of the same
type
This commit is contained in:
parent
d225fa3d2b
commit
effa9de53f
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue