let exportedData: IAWSCSDataObject[] = [];let awscsDataObject: AWSCSDataObject;urlArr.forEach(async (url: string) => {let { data } = await axios.get(url);const $ = cheerio.load(data);let title = this.formatTitle($('title').text());let body = this.formatBody($('div.ccm-page > :not(footer)').text());let operation = 'add';awscsDataObject = new AWSCSDataObject(url, operation, url, title, body);exportedData.push(awscsDataObject.getAWSCSDataObject());});console.log(exportedData); //returns empty why?Why does exportedData array return an empty array when I am pushing into it? when I console.log it inside the forEach I see it an array of objects. Thanks in advance
Submitted November 05, 2019 at 05:51PM by peluchh
No comments:
Post a Comment