title: What is a good design pattern for awaiting Promise.all with extra data
body: <p>I would like some guidance on a good way to pass data along with an array of promises so that the data can be used later after calling <code>await Promise.all()</code>.</p>
  
  <p>I'm pretty new to node and <code>promises</code>. The code below, in summary, does what I want, but it seems messy to have the <code>promises array</code> separate from the corresponding <code>data array</code>. I would think this is a common occurrence and would have a simpler solution.
  I was able to accomplish the same result by attaching a <code>then()</code> function to the <code>asyncFunc return</code>, but this makes the code messier and for some reason takes twice as long to execute.</p>
  
  <pre><code>async function foo(inputs) {
   var promises = [];
   var datas = [];
   for (var input of inputs.values()) {
    promises.push(asyncFunc(input.a));
    datas.push(input.b);
   }
   var outputs = [];
   for (let result of (await Promise.all(promises)).values()) {
    outputs.push({
     data: datas.shift(),
     result: result
    });
   }
   return outputs;
  }
  </code></pre>