src/consumers/promise.js
function toPromise (renderer) {
  // this.sequence, this.batchSize, this.dataReactAttrs
  const buffer = {
    value: [],
    push (segment) { this.value.push(segment); }
  };

  return new Promise((resolve, reject) =>
    setImmediate(
      asyncBatch,
      renderer,
      buffer,
      resolve,
      reject
    )
  )
  .then(() => Promise.all(buffer.value))
  .then(chunks => {
    let html = chunks
      .filter(chunk => typeof chunk === "string")
      .join("");

    if (renderer.dataReactAttrs && !COMMENT_START.test(html)) {
      const checksum = renderer.checksum();
      html = html.replace(TAG_END, ` data-react-checksum="${checksum}"$&`);
    }

    return html;
  });
}
function toPromise (renderer) {
  // this.sequence, this.batchSize, this.dataReactAttrs
  const buffer = {
    value: [],
    push (segment) { this.value.push(segment); }
  };

  return new Promise((resolve, reject) =>
    setImmediate(
      asyncBatch,
      renderer,
      buffer,
      resolve,
      reject
    )
  )
  .then(() => Promise.all(buffer.value))
  .then(chunks => {
    let html = chunks
      .filter(chunk => typeof chunk === "string")
      .join("");

    if (renderer.dataReactAttrs && !COMMENT_START.test(html)) {
      const checksum = renderer.checksum();
      html = html.replace(TAG_END, ` data-react-checksum="${checksum}"$&`);
    }

    return html;
  });
}
function toPromise ( renderer ) { // this.sequence, this.batchSize, this.dataReactAttrs const buffer = { value : [ ] , push ( segment ) { this . value . push ( segment ) ; } } ; return new Promise ( ( resolve , reject ) => setImmediate ( asyncBatch , renderer , buffer , resolve , reject ) ) . then ( ( ) => Promise . all ( buffer . value ) ) . then ( chunks => { let html = chunks . filter ( chunk => typeof chunk === "string" ) . join ( "" ) ; if ( renderer . dataReactAttrs && ! COMMENT_START . test ( html ) ) { const checksum = renderer . checksum ( ) ; html = html . replace ( TAG_END , ` ${ checksum } ` ) ; } return html ; } ) ; }
Consumes the provided sequence and returns a promise with the concatenation of all
sequence segments.

@param      {Renderer}     renderer     The Renderer from which to pull next-vals.

@return     {Promise}                   A promise resolving to the HTML string.
Consumes the provided sequence and returns a promise with the concatenation of all sequence segments .