Skip to content

Instantly share code, notes, and snippets.

@lukebayes
Created March 18, 2009 06:38
Show Gist options
  • Save lukebayes/80973 to your computer and use it in GitHub Desktop.
Save lukebayes/80973 to your computer and use it in GitHub Desktop.
package {
public function findFirst(collection:Array, handler:Function):* {
var result:*;
collection.every(function(item:Object, index:int, items:Array):Boolean {
if(handler(item, index, items)) {
result = item;
return false;
}
return true;
});
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment