Skip to content

Instantly share code, notes, and snippets.

@ragnard
Created May 14, 2012 12:00
Show Gist options
  • Save ragnard/2693580 to your computer and use it in GitHub Desktop.
Save ragnard/2693580 to your computer and use it in GitHub Desktop.
qnet.ModelCollection.prototype.contains = function(obj, identityFn) {
var objIdentity = identityFn(obj)
return goog.array.find(this.models, function(model) {
var modelIdentity = identityFn(model);
if(modelIdentity == objIdentity) {
return true;
} else {
return false;
}
})
}
collection.contains(model, function(m) { return m.getAttribute('GroupID')});
qnet.ModelCollection.prototype.contains = function(obj, identityFn) {
var objIdentity = identityFn(obj)
return goog.array.find(this.models, function(model) {
return objIdentity === identityFn(model);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment