Skip to content

Commit

Permalink
fixed issue with different length of object keys (closes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Melyukov committed Nov 16, 2017
1 parent 40e2bc5 commit 8b189d8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,17 @@ function nanoEqual(a, b) {
return true;
}

var keys = Object.keys(a);
var keysA = Object.keys(a);
var keysBLength = Object.keys(b).length;

for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
if (keysA.length !== keysBLength) {
return false;
}

for (var i = 0, l = keysA.length; i < l; i++) {
var key = keysA[i];

if (!b.hasOwnProperty(keys[i])) {
if (!b.hasOwnProperty(keysA[i])) {
return false;
}

Expand Down

0 comments on commit 8b189d8

Please sign in to comment.