Skip to content

Instantly share code, notes, and snippets.

@CacheFactory
Created December 21, 2012 17:20
Show Gist options
  • Save CacheFactory/4354205 to your computer and use it in GitHub Desktop.
Save CacheFactory/4354205 to your computer and use it in GitHub Desktop.
An Underscore.js mix to find object keys by their values
_.mixin({
findKeysByValue : function(object,value) {
var retVal=[]
for(var key in object){
var obj=object[key]
if(obj==value){
retVal.push(key)
}
}
return retVal;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment