How to use:
export default function getReplies(topicId){ return new Promise(function( resolve, reject ){ _getRepliesForTopic(topicId, function(data){ let replies = data.replies; if(replies){ resolve(replies); }else{ let error = new Error("An error occurred"); reject(error); } }); }); }
getReplies(1) .then(function(replies){ return replies.filter( reply => !reply.isAbuse ); }) .then(function(filteredReplies){ console.log( filteredReplies ); }) .catch(function(error){ console.log(error); }) ;