Skip to content

Instantly share code, notes, and snippets.

@O5ten
Created March 30, 2016 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save O5ten/892508ff077ebff571b9d5f17c5a0f89 to your computer and use it in GitHub Desktop.
Save O5ten/892508ff077ebff571b9d5f17c5a0f89 to your computer and use it in GitHub Desktop.
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