Skip to content

Commit

Permalink
Build unexpected for production
Browse files Browse the repository at this point in the history
  • Loading branch information
sunesimonsen committed Feb 17, 2014
1 parent 534b72e commit 8774e78
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions lib/unexpected.js
Expand Up @@ -37,16 +37,29 @@
return true;
},

indexOf: function (arr, o, i) {
if (arr.length === undefined) {
return -1;
indexOf: function (arr, searchElement, fromIndex) {
var length = arr.length >>> 0; // Hack to convert object.length to a UInt32

fromIndex = +fromIndex || 0;

if (Math.abs(fromIndex) === Infinity) {
fromIndex = 0;
}

if (fromIndex < 0) {
fromIndex += length;
if (fromIndex < 0) {
fromIndex = 0;
}
}

for (var j = arr.length, k = k < 0 ? k + j < 0 ? 0 : k + j : k || 0; k < j && arr[k] !== o; k += 1) {
// Looping
for (;fromIndex < length; fromIndex += 1) {
if (arr[fromIndex] === searchElement) {
return fromIndex;
}
}

return j <= i ? -1 : i;
return -1;
},

getKeys: function (obj) {
Expand Down

0 comments on commit 8774e78

Please sign in to comment.