src/default-template-result-processor.js
function getTemplateResultChunk(result, stack) {
  let chunk = result.readChunk();

  // Skip empty strings
  if (Buffer.isBuffer(chunk) && chunk.length === 0) {
    chunk = result.readChunk();
  }

  // Finished reading, dispose
  if (chunk === null) {
    stack.shift();
  } else if (isTemplateResult(chunk)) {
    // Add to top of stack
    stack.unshift(chunk);
    chunk = getTemplateResultChunk(chunk, stack);
  }

  return chunk;
}
function getTemplateResultChunk(result, stack) {
  let chunk = result.readChunk();

  // Skip empty strings
  if (Buffer.isBuffer(chunk) && chunk.length === 0) {
    chunk = result.readChunk();
  }

  // Finished reading, dispose
  if (chunk === null) {
    stack.shift();
  } else if (isTemplateResult(chunk)) {
    // Add to top of stack
    stack.unshift(chunk);
    chunk = getTemplateResultChunk(chunk, stack);
  }

  return chunk;
}
function getTemplateResultChunk ( result , stack ) { let chunk = result . readChunk ( ) ; // Skip empty strings if ( Buffer . isBuffer ( chunk ) && chunk . length === 0 ) { chunk = result . readChunk ( ) ; } // Finished reading, dispose if ( chunk === null ) { stack . shift ( ) ; } else if ( isTemplateResult ( chunk ) ) { // Add to top of stack stack . unshift ( chunk ) ; chunk = getTemplateResultChunk ( chunk , stack ) ; } return chunk ; }
Retrieve next chunk from "result".
Adds nested TemplateResults to the stack if necessary.

@param { TemplateResult } result
@param { Array<any> } stack
Retrieve next chunk from result . Adds nested TemplateResults to the stack if necessary .