promisify answer on user defined question
This commit is contained in:
@@ -33,10 +33,10 @@ getDataFromWPJSON = function (sourceUrl, page = 1, maxPosts = 10) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAnswerFromWP : async function (sourceUrl){
|
||||
getAnswerFromWP : function (sourceUrl){
|
||||
//This function will extract needed data from JSON, which we got from getDataFromWPJSON
|
||||
//At the moment, it's taking titles and creates answer
|
||||
return await new Promise((resolve,reject)=>{
|
||||
return new Promise((resolve,reject)=>{
|
||||
getDataFromWPJSON(sourceUrl).then(rawData=>{
|
||||
let result='';
|
||||
rawData.forEach(post=>{
|
||||
|
||||
Reference in New Issue
Block a user