Necesito usar el bucle for-of y esperar hasta que se completen todas las solicitudes asincrónicas del bucle de la matriz inputArray y luego devolver la matriz de requests . ¿Cómo puedo hacer que esto suceda?
const getRequests = async () => { const bulkEmails = new BulkEmails(); const requests = []; const inputArray = []; for (let input of inputArray) { const response = await getAsyncData(input); if (response.data) { bulkEmails.addEmail(..email); // Email added if (bulkEmails.emails.length > 500) { // If more than 500 emails in one bulk email object, push object with data to requests array requests.push({bulkEmails, data: response.data}); bulkEmails = []; } } } return requests; } const requests = await getRequests(); // Loop over all (prepare requests to finally send them