(function ($) { Array.prototype.exists = function(prop, value) { if (!value) { value = prop; prop = null; } for (var i = 0; i < this.length; i++) { var line = this[i]; line = this[i].record ? this[i].record : this[i]; if (prop) { if (line[prop] == value) { return true; } } else { if (line == value) { return true; } } } return false; }; Array.prototype.getItem = function(prop, value) { if (!value) { value = prop; prop = null; } for (var i = 0; i < this.length; i++) { var line = this[i]; line = this[i].record ? this[i].record : this[i]; if (prop) { if (line[prop] == value) { return line; } } else { if (line == value) { return line; } } } return null; }; })(jQuery);