Skip to content

Instantly share code, notes, and snippets.

@kirkdotcam
Created March 27, 2018 02:54
Show Gist options
  • Save kirkdotcam/bdabd97ca60fcd4abbcac69c551077ae to your computer and use it in GitHub Desktop.
Save kirkdotcam/bdabd97ca60fcd4abbcac69c551077ae to your computer and use it in GitHub Desktop.
this.find = function(queryObj){
return this.collection.find((element,index)=>{
let searchKey = Object.keys(queryObj)[0];
let searchValue = Object.values(queryObj)[0];
return element[searchKey] === searchValue;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment