3 var toPosInt = require('../../number/to-pos-integer')
4 , value = require('../../object/valid-value')
6 , indexOf = Array.prototype.indexOf
7 , hasOwnProperty = Object.prototype.hasOwnProperty
8 , abs = Math.abs, floor = Math.floor;
10 module.exports = function (searchElement/*, fromIndex*/) {
11 var i, l, fromIndex, val;
12 if (searchElement === searchElement) { //jslint: ignore
13 return indexOf.apply(this, arguments);
16 l = toPosInt(value(this).length);
17 fromIndex = arguments[1];
18 if (isNaN(fromIndex)) fromIndex = 0;
19 else if (fromIndex >= 0) fromIndex = floor(fromIndex);
20 else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
22 for (i = fromIndex; i < l; ++i) {
23 if (hasOwnProperty.call(this, i)) {
25 if (val !== val) return i; //jslint: ignore