Created
May 14, 2012 12:00
-
-
Save ragnard/2693580 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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