Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
indexOf by condition instead of deep-equal
indexOf = function(collection, condition){
if(collection && Array.isArray(collection) && condition){
for(var i = 0; i < collection.length; i+=1){
if(condition(collection[i])){
return i;
}
}
}
return -1;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment