title: empty array outside nested resolve promise
body: <p>im tring to push the return value of the resolve to a variable <code>catWithItems</code> which is outside the resolve. inside the resolve the catWithItems works as expected but when i console log <code>catWithItems</code> outside the loop it returns an empty array.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function categoriesSearch(req, res, next) {
      let categories = req.batch_categories;
      let catWithItems = [];
      _.forEach(categories, (category) =&gt; {
          return new Promise(resolve =&gt; {
              pos.categoriesSearch(req.tenant, category.id)
              .then(item =&gt; {
                  if(item) category.items = item[0];
                  return category;
              })
              .then(category =&gt; {
                  catWithItems.push(category);
                  console.log(catWithItems); //this is works inside here
                  return resolve(catWithItems);
              });
          });
      });
      console.log(catWithItems); //doesn't work returns empty array
      res.json({categoryWithItems: catWithItems });
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>this is the pos.categoriesSearch module. it makes a api call to square.(this works as expected)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function categoriesSearch(tenant, category) {
      let search_items_url = ${tenant.square.api.v2}/catalog/search,
          apiKey = tenant.square.api.key,
          payload = {
              "object_types": ["ITEM"],
              "query": {
                  "prefix_query": {
                      "attribute_name": "category_id",
                      "attribute_prefix": category
                  }
              },
              "search_max_page_limit": 1
          },
          conf = config(search_items_url, apiKey, payload);
          return request.postAsync(conf)
          .then(items =&gt; {
              return items.body.objects;
          });
  }</code></pre>
  </div>
  </div>
  </p>