Skip to content

Instantly share code, notes, and snippets.

@joshgrib
Created July 13, 2016 19:46
Show Gist options
  • Save joshgrib/b952913849159388dfea0a0eed832d0b to your computer and use it in GitHub Desktop.
Save joshgrib/b952913849159388dfea0a0eed832d0b to your computer and use it in GitHub Desktop.
getCommentById(id){
return recipeData.getAllRecipes().then( (all_recipes) => {
resp_comment = {};
all_recipes.forEach( (recipe) => {
recipe.comments.forEach( (comment) => {
if(comment._id === id){
resp_comment = {'_id':id, 'recipeId':recipe._id, 'recipeTitle':recipe.title, 'comment':comment.comment, 'poster':comment.poster};
}
});
});
return resp_comment;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment