title: Synchronous loop in Promise all
body: <p>I would like to do a synchronous loop in a part of my code.
  The function saveInDatabase checks if the item title (string) already exists in the database. That's why it can't be resolved in parallel, otherwise the condition will never apply (and would create duplicates).</p>
  
  <pre><code>Promise.all(arr.map(item =&gt; {
       saveInDatabase(item).then((myResult) =&gt; ... );
  }));
  </code></pre>
  
  <p>I tried to encapsulate this function into separate promises, also tried with npm packages (synchronous.js, sync), but it seems that it does not fit with my code.</p>
  
  <p>Maybe this solution is completely silly.
  Do you think it's a better idea to replace promise.all by a synchronous loop (foreach for example) ? The problem is that I need the results of each iteration...</p>
  
  <p>I'm using Node 6.11.2. Could you give me some tips to handle that ?
  Thank you in advance. </p>