title: How to use reduce in a Promise.all instead of map
body: <p>How can I use reduce in the place of map when using Promise.all? My attempt results in an error <code>UnhandledPromiseRejectionWarning: TypeError: #&lt;Promise&gt; is not iterable at Function.all (&lt;anonymous&gt;)</code></p>
  
  <p>Eventually I would like to conditionally add innerResult to memo but I need to use reduce first.</p>
  
  <pre><code>const _ = require('lodash');
  
  const eq = [{id:1}, {id:2}, {id:3}];
  
  // block to replace
  var biggerEq = _.map(eq, async (e) =&gt; {
    const innerResult = await wait(e.id);
    return innerResult;
  })
  
  // attempt at replacing above block
  // var biggerEq = _.reduce(eq, async (memo, e) =&gt; {
  //   const innerResult = await wait(e.id);
  //   memo.push(innerResult)
  //   return memo;
  // }, []);
  
  Promise.all(biggerEq).then((result) =&gt; {
    console.log(result) // outputs [ 2, 4, 6 ]
  })
  
  
  function wait (id) {
    return new Promise((resolve) =&gt; {
      setTimeout(() =&gt; {
        resolve(id  * 2);
      }, 1000);
    })
  }
  </code></pre>