Skip to content
Browse files

Arrays are not guaranteed to have an indexOf method.

  • Loading branch information...
1 parent 732ef55 commit 2b81fddbc9e3f01ce719f6fc9fae5cd9e9469f28 Chad Weider committed with Aug 27, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/deps/assert.js
View
6 lib/deps/assert.js
@@ -190,17 +190,17 @@ assert._objEquiv = function (a, b) {
return assert._deepEqual(a, b);
}
- var _checkedKeys = [];
+ var _checkedKeys = {};
for (var ka in a) {
- _checkedKeys.push(ka);
+ _checkedKeys[ka] = 1;
if (!assert._deepEqual(a[ka], b[ka])) {
return false;
}
}
for (var kb in b) {
- if (_checkedKeys.indexOf(kb) == -1) {
+ if (!Object.prototype.hasOwnProperty.call(_checkedKeys, kb)) {
return false;
}
}

2 comments on commit 2b81fdd

@aconbere
Collaborator

http://github.com/aconbere/assert - contains this patch. I finally got around to putting it on github :)

@mde
Owner
mde commented on 2b81fdd Sep 3, 2010

Nice!

Please sign in to comment.
Something went wrong with that request. Please try again.