index.js
function readNext() {
    let stream, state;

    while (!isDone) {
      if (!state1.ended
          && (state2.ended || state1.totalDataLen <= state2.totalDataLen)) {
        stream = stream1;
        state = state1;
      } else if (!state2.ended) {
        stream = stream2;
        state = state2;
      } else {
        debug('All streams have ended.  No further reads.');
        return;
      }

      const data = stream.read();
      if (data === null) {
        debug(`Waiting for ${streamName(stream)} to be readable...`);
        stream.once('readable', readNext);
        return;
      }

      handleData.call(stream, state, data);
    }
  }
function readNext() {
    let stream, state;

    while (!isDone) {
      if (!state1.ended
          && (state2.ended || state1.totalDataLen <= state2.totalDataLen)) {
        stream = stream1;
        state = state1;
      } else if (!state2.ended) {
        stream = stream2;
        state = state2;
      } else {
        debug('All streams have ended.  No further reads.');
        return;
      }

      const data = stream.read();
      if (data === null) {
        debug(`Waiting for ${streamName(stream)} to be readable...`);
        stream.once('readable', readNext);
        return;
      }

      handleData.call(stream, state, data);
    }
  }
function readNext ( ) { let stream , state ; while ( ! isDone ) { if ( ! state1 . ended && ( state2 . ended || state1 . totalDataLen <= state2 . totalDataLen ) ) { stream = stream1 ; state = state1 ; } else if ( ! state2 . ended ) { stream = stream2 ; state = state2 ; } else { debug ( 'All streams have ended.  No further reads.' ) ; return ; } const data = stream . read ( ) ; if ( data === null ) { debug ( ` ${ streamName ( stream ) } ` ) ; stream . once ( 'readable' , readNext ) ; return ; } handleData . call ( stream , state , data ) ; } }
Reads from the non-ended stream which has the smallest totalDataLen.
@private
Reads from the non - ended stream which has the smallest totalDataLen .