modules/search/query.js
function _addTrip(trip) {

    // Make sure trip isn't already in list
    let found = false;
    for ( let i = 0; i < rtn.length; i++ ) {
      if ( rtn[i].id === trip.id ) {
        found = true;
      }
    }

    // Process new trip
    if ( !found ) {

      // Make sure the trip stops at any of the next stops, after the current stop
      let stopFound = false;
      let add = false;
      for ( let i = 0; i < trip.stopTimes.length; i++ ) {
        let stopId = trip.stopTimes[i].stop.id;
        if ( !stopFound && stopId === stop.id ) {
          stopFound = true;
        }
        else if ( stopFound ) {
          if ( nextStops.indexOf(stopId) > -1 ) {
            add = true;
            i = trip.stopTimes.length;
          }
        }
      }

      // Add Trip
      if ( add ) {
        rtn.push(trip);
      }

    }

  }
function _addTrip(trip) {

    // Make sure trip isn't already in list
    let found = false;
    for ( let i = 0; i < rtn.length; i++ ) {
      if ( rtn[i].id === trip.id ) {
        found = true;
      }
    }

    // Process new trip
    if ( !found ) {

      // Make sure the trip stops at any of the next stops, after the current stop
      let stopFound = false;
      let add = false;
      for ( let i = 0; i < trip.stopTimes.length; i++ ) {
        let stopId = trip.stopTimes[i].stop.id;
        if ( !stopFound && stopId === stop.id ) {
          stopFound = true;
        }
        else if ( stopFound ) {
          if ( nextStops.indexOf(stopId) > -1 ) {
            add = true;
            i = trip.stopTimes.length;
          }
        }
      }

      // Add Trip
      if ( add ) {
        rtn.push(trip);
      }

    }

  }
function _addTrip ( trip ) { // Make sure trip isn't already in list let found = false ; for ( let i = 0 ; i < rtn . length ; i ++ ) { if ( rtn [ i ] . id === trip . id ) { found = true ; } } // Process new trip if ( ! found ) { // Make sure the trip stops at any of the next stops, after the current stop let stopFound = false ; let add = false ; for ( let i = 0 ; i < trip . stopTimes . length ; i ++ ) { let stopId = trip . stopTimes [ i ] . stop . id ; if ( ! stopFound && stopId === stop . id ) { stopFound = true ; } else if ( stopFound ) { if ( nextStops . indexOf ( stopId ) > - 1 ) { add = true ; i = trip . stopTimes . length ; } } } // Add Trip if ( add ) { rtn . push ( trip ) ; } } }
Add the specified Trip to the return list, if it is not
already present and it continues to one of the next stops
@param {Trip} trip Trip to add
@private
Add the specified Trip to the return list if it is not already present and it continues to one of the next stops