Login Register

dojo.find

I need to be able to find the first element in an array that matches the condition implemented by a callback... dojo.filter loops through all elements... I need to end search after the first matching element is found.
Is there a way to do this?

dojo.some is the closest we

dojo.some is the closest we have, I think. If the callback returns something which doesn't evaluate to false, like 0 or "", then you might even get the result back from dojo.some... otherwise, I guess you'd have to pass it through the closure or something?