Created
May 19, 2011 02:09
-
-
Save sophistifunk/980033 to your computer and use it in GitHub Desktop.
Find:In:Having:Of:
This file contains hidden or 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
package intelligentpathways.utils | |
{ | |
/** | |
* Search a collection, returning the object where object[fieldName] == value. Because I'm sick of writing this ugly loop for every combobox in a system :( | |
*/ | |
public function findInHavingOf(collection:*, fieldName:String, value:*):* | |
{ | |
for each (var testee:* in collection) | |
if (testee && fieldName in testee && testee[fieldName] == value) | |
return testee; | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment