List of utility methods to do Array Get Object
getById(id)Array.prototype.getById = function(id) { for(var i=0; i<this.length; i++) { if(this[i]._id == id) { return this[i]; | |
getByKey(aName)Array.prototype.getByKey = function(aName) { for(var i = this.length-1; i >= 0; i--) if(this[i].getKey() === aName) return this[i]; return null; }; | |
getEach(code)Array.prototype.getEach = function(code){ var rev = []; for(var i = 0 ; i < this.length ; i++){ rev.push(this[i][code]); return rev; }; | |
getFrequency()Array.prototype.getFrequency=function(){ this.sort() var count=0 var max={ val:0, num:0 for (var i =1;i<this.length;i++){ if(this[i]===""){ ... | |
getIndex(a)Array.prototype.getIndex=function(a){ var index=-1; for(var i=0;i<this.length;i++){ if(this[i]==a){ index=i; break; return index; ... | |
getIndexBy(name, value)'use strict'; Array.prototype.getIndexBy = function (name, value) { for (var i = 0; i < this.length; i++) { if (this[i][name] === value) { return i; }; | |
getIndexBy(name, value)Array.prototype.getIndexBy = function(name, value) { for (var i = 0; i < this.length; i++) { if (this[i][name] == value) { return i; return -1; | |
getIndexBy(name, value)angular .module('app', [ 'angular.filter', 'ui.router', 'ngAnimate', 'ngMaterial', 'user', 'login', 'register', ... | |
getIndexByKey(name)Array.prototype.getIndexByKey = function(name) { for (var i = 0; i < this.length; i++) { if (this[i][name]) { return i; return -1; | |
getIndexByVal(key,val)Array.prototype.getIndexByVal=function(key,val){ for (var i in this){ if(this[i].hasOwnProperty(key)){ if(this[i][key]===val){ return i return false ... |