Here you can find the source of indexOfElement(search, func)
Array.prototype.indexOfElement = function(search, func) { for(var i = 0; i < this.length; i++) { var result = func(search, this[i]); if(result)// w w w . java 2 s .c o m return i; } return -1; }
Array.prototype.indexOfByFunction = function (filter) { return indexOfByFunction(this, filter); };
Array.prototype.indexOfById = function(id){ var index = -1, i = 0, l = this.length, item; for(; l--; i++){ item = this[i]; if(parseInt(item.id) === id) return i; ...
Array.prototype.indexOfByKey = function(aKey) { for(var i = 0; i < this.length; i++) if(this[i].getKey() === aKey) return i; return -1; };
Array.prototype.indexOfByProp = function(obj, property) { let result = -1; this.forEach(function(currentObj, index) { if (currentObj[property] === obj[property]) { result = index; }); return result; }; ...
Array.prototype.indexOfContent = function (searchTerm) { let index = -1; for (var i = 0, len = this.length; i < len; i++) { if (this[i].content == searchTerm) { index = i; break; return index ...
Array.prototype.indexOfGreatestLessThan = function(val) { var minIndex = 0; var minDist = Number.MAX_VALUE; for (var i = 0; i < this.length; i++) { if ((this[i] <= val) && (Math.abs(this[i] - val) < minDist)) { minDist = Math.abs(this[i] - val); minIndex = i; return minIndex;
Array.prototype.indexOfKey = function(key){ for(var i in this) if(i == key) return i; return -1;
Array.prototype.indexOfLeastGreaterThan = function(val) { var minIndex = 0; var minDist = Number.MAX_VALUE; for (var i = 0; i < this.length; i++) { if ((this[i] >= val) && (Math.abs(this[i] - val) < minDist)) { minDist = Math.abs(this[i] - val); minIndex = i; return minIndex;
Array.prototype.indexOfMatchFunction = function(func) { "use strict"; for (var i in this) { if (!this.hasOwnProperty(i)) continue; var element = this[i]; if (func(element)) return parseInt(i); return -1; };