index.js
function endListener(state) {
    // Note:  If incremental is conclusive for 'end' event, this will be called
    // with isDone === true, since removeListener doesn't affect listeners for
    // an event which is already in-progress.
    if (state.ended || isDone) {
      return;
    }

    state.ended = true;
    ended += 1;

    debug(`${streamName(this)} has ended.`);

    if (options.incremental) {
      if (doCompare(options.incremental, CompareType.incremental)) {
        return;
      }
    }

    if (ended === 2) {
      const postEndCompare = function() {
        doCompare(options.compare, CompareType.last);
      };
      if (options.delay) {
        debug(`All streams have ended.  Delaying for ${options.delay
        }ms before final compare.`);
        postEndTimeout = setTimeout(postEndCompare, options.delay);
      } else {
        // Let pending I/O and callbacks complete to catch some errant events
        debug('All streams have ended.  Delaying before final compare.');
        postEndImmediate = setImmediate(postEndCompare);
      }
    }
  }
function endListener(state) {
    // Note:  If incremental is conclusive for 'end' event, this will be called
    // with isDone === true, since removeListener doesn't affect listeners for
    // an event which is already in-progress.
    if (state.ended || isDone) {
      return;
    }

    state.ended = true;
    ended += 1;

    debug(`${streamName(this)} has ended.`);

    if (options.incremental) {
      if (doCompare(options.incremental, CompareType.incremental)) {
        return;
      }
    }

    if (ended === 2) {
      const postEndCompare = function() {
        doCompare(options.compare, CompareType.last);
      };
      if (options.delay) {
        debug(`All streams have ended.  Delaying for ${options.delay
        }ms before final compare.`);
        postEndTimeout = setTimeout(postEndCompare, options.delay);
      } else {
        // Let pending I/O and callbacks complete to catch some errant events
        debug('All streams have ended.  Delaying before final compare.');
        postEndImmediate = setImmediate(postEndCompare);
      }
    }
  }
function endListener ( state ) { // Note:  If incremental is conclusive for 'end' event, this will be called // with isDone === true, since removeListener doesn't affect listeners for // an event which is already in-progress. if ( state . ended || isDone ) { return ; } state . ended = true ; ended += 1 ; debug ( ` ${ streamName ( this ) } ` ) ; if ( options . incremental ) { if ( doCompare ( options . incremental , CompareType . incremental ) ) { return ; } } if ( ended === 2 ) { const postEndCompare = function ( ) { doCompare ( options . compare , CompareType . last ) ; } ; if ( options . delay ) { debug ( ` ${ options . delay } ` ) ; postEndTimeout = setTimeout ( postEndCompare , options . delay ) ; } else { // Let pending I/O and callbacks complete to catch some errant events debug ( 'All streams have ended.  Delaying before final compare.' ) ; postEndImmediate = setImmediate ( postEndCompare ) ; } } }
Handles stream end events.
@this {!Readable}
@private
Handles stream end events .