Check if the Trip goes from Origin --> Destination
@param {Trip} trip The Trip to check
@param {Stop} origin Origin Stop
@param {Stop} destination Destination Stop
@returns {boolean}
@private
964368
function _tripGoesTo(trip, origin, destination) {
  let originFound = false;
  for ( let i = 0; i < trip.stopTimes.length; i++ ) {
    if ( !originFound && trip.stopTimes[i].stop.id === origin.id ) {
      originFound = true;
    }
    else if ( originFound ) {
      if ( trip.stopTimes[i].stop.id === destination.id ) {
        return true;
      }
    }
  }
  return false;
}
723045
function isPortTaken(port, fn) {
  const net = require('net')
  const tester = net.createServer()
    .once('error', function (err) {
      if (err.code != 'EADDRINUSE') return fn(err)
      fn(null, true)
    })
    .once('listening', function() {
      tester.once('close', function() { fn(null, false) })
        .close()
    })
    .listen(port)
}
1251702
function isSameOrigin(a, b) {
  var urlA = parseURL(a);
  var urlB = parseURL(b);
  if (!urlA || !urlB) {
    return false;
  }
  if (urlA.origin === urlB.origin) {
    return true;
  }
  if (
    urlA.protocol === urlB.protocol &&
    urlA.hostname === urlB.hostname &&
    urlA.port === urlB.port
  ) {
    return true;
  }
  return false;
}
1274907
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);
      }

    }

  }
274690
function(){
		if (destinationIsRelative){
			_destination = _path.join(process.cwd(), "../..", _destination);
		}
		
		if(!_fs.existsSync(_destination)){
			_fs.mkdirSync(_destination);
		}
		
		var destinationPath = _path.join(_destination, "/" + SCRIPT_NAME);
		var sourcePath = _path.resolve(_path.dirname(module.filename), "../src/" + SCRIPT_NAME);
		var source = _fs.createReadStream(sourcePath);
		var dest = _fs.createWriteStream(destinationPath);
		dest.pipe(source);
		
		console.log("Client Installation Complete!\n");
		console.log(SCRIPT_NAME + " has been installed at: " + destinationPath);
		_prompt.close();
	}
841030
function (origin) {
            if (origin == null) {
                return;
            }
            var /** @type {?} */ dir = this._getLayoutDirection();
            if ((dir == 'ltr' && origin <= 0) || (dir == 'rtl' && origin > 0)) {
                this._origin = 'left';
            }
            else {
                this._origin = 'right';
            }
        }
794938
function(source, destination, i, callback, excluded) {
        var isExcluded = false;
        if ( typeof(excluded) != 'undefined' && excluded != undefined) {
            var f, p = source.split('/');
            f = p[p.length-1];
            for (var r= 0; r<excluded.length; ++r) {
                if ( typeof(excluded[r]) == 'object' ) {
                    if (excluded[r].test(f)) {
                        isExcluded = true
                    }
                } else if (f === excluded[r]) {
                    isExcluded = true
                }
            }
        }


        if (!isExcluded) {
            fs.lstat(destination, function(err, stats) {

                //Means that nothing exists. Needs create.
                if (err) {
                    startCopy(source, destination, i, function(err, i) {
                        //TODO - log error.
                        callback(err, source, i)
                    })
                } else {

                    if ( stats.isDirectory() ) {
                        var str;
                        var path = '/'+ (str = source.split(/\//g))[str.length-1];
                        destination += path
                    }

                    fs.exists(destination, function(replaceFlag) {
                        if (replaceFlag) {
                            fs.unlink(destination, function(err) {
                                //TODO - log error.
                                startCopy(source, destination, i, function(err, i) {

                                    callback(err, source, i)
                                })
                            })
                        } else {
                            startCopy(source, destination, i, function(err, i) {
                                //TODO - log error.
                                callback(err, source, i)
                            })
                        }
                    })
                }//EO if (err)
            })
        } else {
            callback(false, source, i)
        }

        var startCopy = function(source, destination, i, callback) {

            copyFile(source, destination, i, function(err, i) {
                if (err) {
                    console.error(err.stack)
                }
                callback(err, i)
            })
        }
    }
101379
function visit() {
  if (this.isBlacklisted()) return false;
  if (this.opts.shouldSkip && this.opts.shouldSkip(this)) return false;

  this.call("enter");

  if (this.shouldSkip) {
    return this.shouldStop;
  }

  var node = this.node;
  var opts = this.opts;

  if (node) {
    if (Array.isArray(node)) {
      // traverse over these replacement nodes we purposely don't call exitNode
      // as the original node has been destroyed
      for (var i = 0; i < node.length; i++) {
        _index2["default"].node(node[i], opts, this.scope, this.state, this, this.skipKeys);
      }
    } else {
      _index2["default"].node(node, opts, this.scope, this.state, this, this.skipKeys);
      this.call("exit");
    }
  }

  return this.shouldStop;
}
354462
public boolean removeDestination(String id) {
		logger.trace("removing destination {}", id);
		for(Destination<M> destination : destinations) {
			if(destination.getId().equals(id)) {
				destinations.remove(destination);
				return true;
			}
		}
		return false;
	}
602674
function extend(destination, source) {
    for (var k in source) {
      if (source.hasOwnProperty(k)) {
        destination[k] = source[k];
      }
    }
    return destination;
  }
1023222
def on_destination(self, *args):
        """"""
        if self.destination is None:
            Clock.schedule_once(self.on_destination, 0)
            return
        self.destination.bind(
            pos=self._trigger_repoint,
            size=self._trigger_repoint
        )
922551
def connections(self, origin, destination, dt=datetime.now(), only_direct=False):
        
        query = {
            'S': origin,
            'Z': destination,
            'date': dt.strftime("%d.%m.%y"),
            'time': dt.strftime("%H:%M"),
            'start': 1,
            'REQ0JourneyProduct_opt0': 1 if only_direct else 0
        }
        rsp = requests.get('http://mobile.bahn.de/bin/mobil/query.exe/dox?', params=query)
        return parse_connections(rsp.text)
172338
def departure(stop, destination):
    """"""
    from pyruter.api import Departures

    async def get_departures():
        """"""
        async with aiohttp.ClientSession() as session:
            data = Departures(LOOP, stop, destination, session)
            await data.get_departures()
            print(json.dumps(data.departures, indent=4, sort_keys=True))
    LOOP.run_until_complete(get_departures())
40955
def _check_cors_origin(origin, allowed_origins):
    '''
    
    '''
    if isinstance(allowed_origins, list):
        if origin in allowed_origins:
            return origin
    elif allowed_origins == '*':
        return allowed_origins
    elif allowed_origins == origin:
        # Cors origin is either * or specific origin
        return allowed_origins
481536
public final void checkPermission( Destination destination , String action ) throws JMSException
    {
    	if (securityContext == null)
            return; // Security is disabled
    	
    	DestinationRef destinationRef = DestinationTools.asRef(destination);
    	securityContext.checkPermission(destinationRef.getResourceName(), action);        
    }
18524
function checkMissingDir(destinationFile) {
  var filePath = path.dirname(destinationFile);
  var pathAbsolute = path.isAbsolute(filePath);
  var directories = filePath.split(path.sep);
  return transversePath(directories);
}
141277
def has_frames(self, destination):
        
        session = meta.Session()
        sel = select([model.frames_table.c.message_id]).where(
            model.frames_table.c.destination == destination)
        result = session.execute(sel)

        first = result.fetchone()
        return first is not None