title: Async/Await not waiting
body: <p>I'm running into an issue which I don't fully understand. I feel like there are likely concepts which I haven't grasped, code that could be optimized, and possibly a bug thrown in for good measure.</p>
  
  <p>To greatly simplify the overall flow:</p>
  
  <ol>
  <li>A request is made to an external API</li>
  <li>The returned JSON object is parsed and scanned for link references</li>
  <li>If any link references are found, additional requests are made to populate/replace link references with real JSON data</li>
  <li>Once all link references have been replaced, the original request is returned and used to build content</li>
  </ol>
  
  <p>Here, is the original request (#1):</p>
  
  <pre><code>await Store.get(Constants.Contentful.ENTRY, Contentful[page.file])
  </code></pre>
  
  <p>Store.get is represented by:</p>
  
  <pre><code>async get(type, id) {
      return await this._get(type, id);
  }
  </code></pre>
  
  <p>Which calls:</p>
  
  <pre><code>_get(type, id) {
      return new Promise(async (resolve, reject) =&gt; {
          var data = _json[id] = _json[id] || await this._api(type, id);
  
          console.log(data)
  
          if(isAsset(data)) {
              resolve(data);
          } else if(isEntry(data)) {
              await this._scan(data);
  
              resolve(data);
          } else {
              const error = 'Response is not entry/asset.';
  
              console.log(error);
  
              reject(error);
          }
      });
  }
  </code></pre>
  
  <p>The API call is:</p>
  
  <pre><code>_api(type, id) {
      return new Promise((resolve, reject) =&gt; {
          Request('http://cdn.contentful.com/spaces/' + Constants.Contentful.SPACE + '/' + (!type || type === Constants.Contentful.ENTRY ? 'entries' : 'assets') + '/' + id + '?access_token=' + Constants.Contentful.PRODUCTION_TOKEN, (error, response, data) =&gt; {
              if(error) {
                  console.log(error);
  
                  reject(error);
              } else {
                  data = JSON.parse(data);
  
                  if(data.sys.type === Constants.Contentful.ERROR) {
                      console.log(data);
  
                      reject(data);
                  } else {
                      resolve(data);
                  }
              }
          });
      });
  }
  </code></pre>
  
  <p>When an entry is returned, it is scanned:</p>
  
  <pre><code>_scan(data) {
      return new Promise((resolve, reject) =&gt; {
          if(data &amp;&amp; data.fields) {
              const keys = Object.keys(data.fields);
  
              keys.forEach(async (key, i) =&gt; {
                  var val = data.fields[key];
  
                  if(isLink(val)) {
                      var child = await this._get(val.sys.linkType.toUpperCase(), val.sys.id);
  
                      this._inject(data.fields, key, undefined, child);
                  } else if(isLinkArray(val)) {
                      var children = await* val.map(async (link) =&gt; await this._get(link.sys.linkType.toUpperCase(), link.sys.id));
  
                      children.forEach((child, index) =&gt; {
                          this._inject(data.fields, key, index, child);
                      });
                  } else {
                      await new Promise((resolve) =&gt; setTimeout(resolve, 0));
                  }
  
                  if(i === keys.length - 1) {
                      resolve();
                  }
              });
          } else {
              const error = 'Required data is unavailable.';
  
              console.log(error);
  
              reject(error);
          }
      });
  }
  </code></pre>
  
  <p>If link references are found, additional requests are made and then the resulting JSON is injected into the original JSON in place of the reference:</p>
  
  <pre><code>_inject(fields, key, index, data) {
      if(isNaN(index)) {
          fields[key] = data;
      } else {
          fields[key][index] = data;
      }
  }
  </code></pre>
  
  <p>Notice, I'm using <code>async</code>, <code>await</code>, and <code>Promise</code>'s I believe in their intended manor. <strong>What ends up happening:</strong> The calls for referenced data (gets resulting of _scan) end up occurring after the original request is returned. This ends up providing incomplete data to the content template.</p>
  
  <p>Additional information concerning my build setup:</p>
  
  <ul>
  <li>npm@2.14.2</li>
  <li>node@4.0.0</li>
  <li>webpack@1.12.2</li>
  <li>babel@5.8.34</li>
  <li>babel-loader@5.4.0</li>
  </ul>