Skip to content

Commit

Permalink
Use hasOwnProperty instead of "in".
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Mar 23, 2014
1 parent b899f88 commit 909f259
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.exports = function isEqual(value, other) {
var index = value.length;
do {
--index;
} while (index > 0 && index in value && index in other && isEqual(value[index], other[index]));
} while (index > 0 && has.call(value, index) && has.call(other, index) && isEqual(value[index], other[index]));
return index <= 0;
}

Expand All @@ -78,13 +78,13 @@ module.exports = function isEqual(value, other) {
var key;
for (key in value) {
if (has.call(value, key)) {
if (!(key in other)) { return false; }
if (!has.call(other, key)) { return false; }
if (!isEqual(value[key], other[key])) { return false; }
}
}
for (key in other) {
if (has.call(other, key)) {
if (!(key in value)) { return false; }
if (!has.call(value, key)) { return false; }
if (!isEqual(other[key], value[key])) { return false; }
}
}
Expand Down

0 comments on commit 909f259

Please sign in to comment.