Checks if the current route is valid matches with the given router
@private
@param {KoaContext} ctx
@param {KoaNext} next
@return {Object|String} if route does not math it will return 'koa-no-route'
496041
function EvalRoute (ctx, next) {
	let router = this;
	let matched = router.match(router.opts.routerPath || ctx.routerPath || ctx.path, ctx.method);
	/* istanbul ignore else */
	if (ctx.matched) {
		ctx.matched.push.apply(ctx.matched, matched.path);
	} else {
		ctx.matched = matched.path;
	}
	if (matched.route) {
		return this.middleware()(ctx, next);
	} else {
		return Promise.resolve('koaton-no-route');
	}
}
343484
def check_next_match(self, match, new_relations, subject_graph, one_match):
        """"""
        if not CustomPattern.check_next_match(self, match, new_relations, subject_graph, one_match):
            return False
        if self.strong:
            # can this ever become a strong ring?
            vertex1_start = match.forward[self.pattern_graph.central_vertex]
            for vertex1 in new_relations.values():
                paths = list(subject_graph.iter_shortest_paths(vertex1, vertex1_start))
                if self.size % 2 == 0 and len(match) == self.size:
                    if len(paths) != 2:
                        #print "NRingPattern.check_next_match: not strong a.1"
                        return False
                    for path in paths:
                        if len(path) != len(match)//2+1:
                            #print "NRingPattern.check_next_match: not strong a.2"
                            return False
                else:
                    if len(paths) != 1:
                        #print "NRingPattern.check_next_match: not strong b.1"
                        return False
                    if len(paths[0]) != (len(match)+1)//2:
                        #print "NRingPattern.check_next_match: not strong b.2"
                        return False
            #print "RingPattern.check_next_match: no remarks"
        return True
75424
function (app, next) {
      app.use(function (req, res, next) {
        router.handle(req, res, next);
      });

      next(null, app);
    }
938406
function(router, req, res) {
    var routeFound = false,
      url = req.url.toString(),
      method = req.method;
    for (var i = 0; i < router.routes.length; i++) {
      var route = router.routes[i];
      if (url.indexOf(route.route) != -1 && route.method == method) {
        if (url != '/' && route.route == '/') {
          continue;
        }
        if (url != route.route && !route.hasObject) {
          continue;
        }
        if (method === 'GET') {
          req.body = {};
          if (route.hasObject) {
            req.body[route.objectName] = basename(url);
          }
          route.callback(req, res);
          routeFound = true;
          break;
        } else {
          ReqToObject(req, res, route);
          routeFound = true;
          break;
        }
      }
    }
    return routeFound;
  }
631763
def check_next_match(self, match, new_relations, subject_graph, one_match):
        """"""
        # avoid duplicate rings (order of traversal)
        if len(match) == 3:
            if match.forward[1] < match.forward[2]:
                #print "RingPattern.check_next_match: duplicate order", match.forward[1], match.forward[2]
                return False
        # avoid duplicate rings (starting point)
        for vertex1 in new_relations.values():
            if vertex1 < match.forward[0]:
                #print "RingPattern.check_next_match: duplicate start", vertex1, match.forward[0]
                return False
        # can this ever become a strong ring?
        for vertex1 in new_relations.values():
            paths = list(subject_graph.iter_shortest_paths(vertex1, match.forward[0]))
            if len(paths) != 1:
                #print "RingPattern.check_next_match: not strong 1"
                return False
            if len(paths[0]) != (len(match)+1)//2:
                #print "RingPattern.check_next_match: not strong 2"
                return False
        return True
530426
function (option, handler, trace) {
    return function (req, res, next) {

        if (option.v) {
            if (req.version != option.v) {
                if(trace){
                    logger(colors.yellow('SKIP ROUTE: %s {v:%s, c:%s} %s'), req.method, option.v, option.c, req.route.path);
                }
                return next();
            }
        }

        if (option.c) {
            if (req.channel != option.c) {
                if(trace){
                    logger(colors.yellow('SKIP ROUTE: %s {v:%s, c:%s} %s'), req.method, option.v, option.c, req.route.path);
                }
                return next();
            }
        }

        if(trace){
            logger(colors.green('MATCH ROUTE: %s {v:%s, c:%s} %s'), req.method, option.v, option.c, req.route.path);
        }

        handler(req, res, next);
    };
}
941574
function routeIsActive(pathname, routes, params, indexOnly) {
  // TODO: This is a bit ugly. It keeps around support for treating pathnames
  // without preceding slashes as absolute paths, but possibly also works
  // around the same quirks with basenames as in matchRoutes.
  if (pathname.charAt(0) !== '/') {
    pathname = `/${pathname}`
  }

  const i = getMatchingRouteIndex(pathname, routes, params)

  if (i === null) {
    // No match.
    return false
  } else if (!indexOnly) {
    // Any match is good enough.
    return true
  }

  // If any remaining routes past the match index have paths, then we can't
  // be on the index route.
  return routes.slice(i + 1).every(route => !route.path)
}
891418
private boolean validSecondStep(LegStep secondStep, RouteProgress routeProgress) {
    return routeProgress.currentLegProgress().upComingStep() != null
      && routeProgress.currentLegProgress().upComingStep().equals(secondStep);
  }
155758
function decendTreeByRoutedToken(node, value, routeToken) {
    var next = null;
    switch (value) {
        case Keys.keys:
        case Keys.integers:
        case Keys.ranges:
            next = node[value];
            if (!next) {
                next = node[value] = {};
            }
            break;
        default:
            break;
    }
    if (next && routeToken) {
        // matches the naming information on the node.
        next[Keys.named] = routeToken.named;
        next[Keys.name] = routeToken.name;
    }

    return next;
}
84433
function(ctx) {
    assert(this.args.length == 3);
    if (this.args[0].evaluate(ctx).booleanValue()) {
      return this.args[1].evaluate(ctx);
    } else {
      return this.args[2].evaluate(ctx);
    }
  }
182366
function addMatch (route) {
  let routePath = route.path
  let paramNames = []
  let matched
  // find any paths prefixed with `:` or `%`, and treat them as capture groups
  while ((matched = routePath.match(paramPattern)) !== null) {
    routePath = routePath.replace(paramPattern, '([^?/]+)')
    paramNames.push(matched[1])
  }
  // if a route ends with `index`, allow matching that route without matching the `index` part
  if (path.basename(routePath) === 'index') {
    route.isIndex = true
    routePath = routePath.replace(/\/index$/, '/?([:%]?index)?')
  }
  // create a regex with our path
  let pattern = new RegExp(`^${routePath}(\\?(.*)|$)`, 'i')
  route.pattern = pattern
  route.match = url => {
    let m = url.match(pattern)
    if (m) {
      let params = paramNames.reduce((o, p, idx) => {
        o[p] = m[idx + 1]
        return o
      }, {})
      let query = qs.parse(m[m.length - 1])
      return { params, query }
    }
  }
  return route
}
903736
function(route){
    var res;

    if(route[0] === '/' && route[route.length-1] === '/' ) {
      res = new RegExp(route.slice(1, route.length-1), '');
      res._isRegexp = true;
    }
    else if(typeof route == 'string'){
      res = Backbone.Router.prototype._routeToRegExp.call(this, route);
      res._isString = true;
    }

    return res;
  }
1266686
function checkUrl(){
    var newPath = location.hash.substr(1) || '';

    if (newPath != currentPath)
    {
      // check for recursion
      if (preventRecursion(newPath))
        return;

      // save current path
      currentPath = newPath;

      var routesToLeave = [];
      var routesToEnter = [];
      var routesToMatch = [];

      allRoutes.forEach(function(route){
        var flags = route.processLocation_(newPath);

        if (flags & ROUTE_LEAVE)
          routesToLeave.push(route);
        if (flags & ROUTE_ENTER)
          routesToEnter.push(route);
        if (flags & ROUTE_MATCH)
          routesToMatch.push(route);
      });

      for (var i = 0; i < routesToLeave.length; i++)
        routeLeave(routesToLeave[i]);

      for (var i = 0; i < routesToEnter.length; i++)
        routeEnter(routesToEnter[i]);

      for (var i = 0; i < routesToMatch.length; i++)
        routeMatch(routesToMatch[i]);

      /** @cut */ flushLog(namespace + ': hash changed to "' + newPath + '"');
    }
    else
    {
      allRoutes.forEach(function(route){
        if (route.value)
        {
          routeEnter(route, true);
          routeMatch(route, true);
        }
      });

      /** @cut */ flushLog(namespace + ': checkUrl()');
    }
  }
1280995
def request_matches_route(self, actual_route: str, expected_route: str):
        
        expected_params = self.get_url_params(expected_route)
        actual_params = self.get_url_params(actual_route)
        i = 0

        if len(expected_params) == len(actual_params):
            for param in actual_params:
                if expected_params[i][0] != "{":
                    if param != expected_params[i]:
                        return False
                i += 1
        else:
            return False

        return True
976944
function parseMiddleware(ctx, next) {
      try {
        ctx.event = JSON.parse(ctx.content.toString());
        next();
      } catch (e) {
        throw e;
      }
    }
1032040
public boolean anyMatched(String[] requestPathTokens) {
		Map<String, String> pathParams = new HashMap<>();
		for (PathPattern pattern : routes.keySet()) {
			if (pattern.match(requestPathTokens, pathParams)) {
				return true;
			}

			// Reset for the next loop
			pathParams.clear();
		}

		return false;
	}
507027
function Route(pattern, callback, priority, router) {
        var isRegexPattern = isRegExp(pattern),
            patternLexer = router.patternLexer;
        this._router = router;
        this._pattern = pattern;
        this._paramsIds = isRegexPattern? null : patternLexer.getParamIds(pattern);
        this._optionalParamsIds = isRegexPattern? null : patternLexer.getOptionalParamsIds(pattern);
        this._matchRegexp = isRegexPattern? pattern : patternLexer.compilePattern(pattern, router.ignoreCase);
        this.matched = new signals.Signal();
        this.switched = new signals.Signal();
        if (callback) {
            this.matched.add(callback);
        }
        this._priority = priority || 0;
    }