¿Cómo hacer async/await for si tengo 2 o más async/awaits en for loop?
Me gustaría hacer este trabajo:
fetchedData.forEach(async i => { const product3P = await checkProducts3P(i.sku); const model = await checkModels(product3P.model); const row = { sku: i.sku, category: i.categories, isPresentSKU: !!product3P, isPresentModel: !!model, isPresentCategory: null }; results.push(row); });Intenté esto pero no funciona:
const fn = (i) => { return new Promise((resolve) => { const product3P = checkProducts3P(i.sku); const model = checkModels(product3P.model); const row = { sku: i.sku, category: i.categories, isPresentSKU: !!product3P, isPresentModel: !!model, isPresentCategory: null }; resolve(row); }); }; const actions = fetchedData.map(fn); const promised = Promise.all(actions); await promised.then(console.log);¿Qué estoy haciendo mal con la segunda versión?