Permalink
Browse files

Merge pull request #8 from hokaccha/fix_indexOf

Fix bug `indexOf`. when arr is number, it was return 0
  • Loading branch information...
2 parents 0b856ac + 460925c commit 3b010b9cea031b3a1405e864f6c4235f9b34d6c1 @rauchg rauchg committed Feb 4, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 expect.js
View
@@ -478,6 +478,10 @@
return Array.prototype.indexOf.call(arr, o, i);
}
+ if (arr.length === undefined) {
+ return -1;
+ }
+
for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0
; i < j && arr[i] !== o; i++);

0 comments on commit 3b010b9

Please sign in to comment.