const getParcelPickups = (parcels) => { return Promise.all( parcels.map((parcel) => { const [warehouse] = cacheContainer.warehousesByMerchantId.get(Number(parcel.merchantId)) || []; const pickupRegion = cacheContainer.pickupRegionsByGeoId.get(warehouse.geoId); return getPickupFromParcel({ warehouse, pickupRegion }); })) };
const getParcelPickups = (parcels) => { const pickups = []; for (const parcel of parcels) { const [warehouse] = cacheContainer.warehousesByMerchantId.get(Number(parcel.merchantId)) || []; const pickupRegion = cacheContainer.pickupRegionsByGeoId.get(warehouse.geoId); pickups.push(getPickupFromParcel({ warehouse, pickupRegion })); } return Promise.all(pickups); };