/*
Current route values
425056
public int currentStepCount() {
    if (currentDirectionRoute() == null) {
      return 0;
    }
    int stepCount = 0;
    for (RouteLeg leg : currentDirectionRoute().legs()) {
      stepCount += leg.steps().size();
    }
    return stepCount;
  }
1223193
function (route) {
  if (!route) {
    return null;
  }
  let ts = route.split('.');
  if (ts.length !== 3) {
    return null;
  }

  return {
    route: route,
    serverType: ts[0],
    handler: ts[1],
    method: ts[2]
  };
}
689364
function(uri) {

        if (this._routes[uri] !== undefined) {
            return uri;
        }

        for (var route in this._routes) {
            if (this.is(route, uri)) {
                return route;
            }
        }

        return false;
    }
871781
public function viewRoutes()
	{
		// variables
		$routes = \Route::getRoutes();
		$array  = [];
		foreach ($routes as /** @var Route */ $route)
		{
			// properties
			$methods = method_exists($route, 'getMethods') ? $route->getMethods() : $route->methods;
			$uri = method_exists($route, 'getUri') ? $route->getUri() : $route->uri;
			$action = $route->getAction()['uses'];

			// data
			$array[] =
			[
				'methods'   => implode('|', $methods),
				'uri'       => $uri,
				'name'      => $route->getName(),
				'action'    => $action instanceof \Closure ? 'Closure' : $action,
				'middleware'=> implode(', ', $route->middleware()),
			];
		}

		vue('sketchpad::help/tools/routes', $array);
	}
693901
public function seeCurrentRouteIs($routeName, array $params = [])
    {
        $router = $this->bootstrap->getBootstrap()->getResource('frontcontroller')->getRouter();
        $url = $router->assemble($params, $routeName);
        $this->seeCurrentUrlEquals($url);
    }
61910
function _dynamicEnding() {

  // If the route ends with a dynamic segment, make sure the earlier
  // segments match.
  if(_routeBoom[_routeBoom.length - 1] === '**') {

    dbug('Found dynamic ending on ' + _routeBoom.join('/'));

    var oldLength = _locationBoom.length;   // Save the current length for comparison later

    for(var f = _locationBoom.length - 1; f >= 0; f--) {
      if(_locationBoom[f] === _routeBoom[_routeBoom.length - 2] || _routeBoom[_routeBoom.length - 2] === "*") {
        _locationBoom.splice(f, _locationBoom.length - f);  // Remove the ending segments
        _routeBoom.splice(_routeBoom.length - 1, 1);        // Remove the **
        break;
      } 
    }

    // If location_boom never gets truncated, then this isn't the right route
    if(oldLength === _locationBoom.length) return false;
  }

  return true; 
}
1212463
public function current()
    {
        $sKey = key($this->values);

        return (true === isset($this->values[$sKey])) ? $this->values[$sKey] : null;
    }
634775
public function currentRouteNamed($name)
    {
        if (! is_null($route = $this->current())) {
            return ($route->getName() == $name);
        }

        return false;
    }
792948
function setRoutesInState(routes) {
    const routesByName = {};
    routes.forEach(route => {
        routesByName[route.name] = route.route;
    });
    return routesByName;
}
1020212
function getActiveRoutes(params) {
        var activeRoutes = {},
            availableRoutes =
            {
                'index': 'GET     /',
                'create': 'POST    /',
                'new': 'GET     /new',
                'edit': 'GET     /:id/edit',
                'destroy': 'DELETE  /:id',
                'update': 'PUT     /:id',
                'show': 'GET     /:id',
                'destroyall': 'DELETE  /'
            },
            availableRoutesSingleton =
            {
                'show': 'GET     /show',
                'create': 'POST    /',
                'new': 'GET     /new',
                'edit': 'GET     /edit',
                'destroy': 'DELETE  /',
                'update': 'PUT     /',
                'destroyall': 'DELETE  /'
            };

        if (params.singleton) {
            availableRoutes = availableRoutesSingleton;
        }

        // 1. only
        if (params.only) {
            if (typeof params.only === 'string') {
                params.only = [params.only];
            }
            params.only.forEach(function (action) {
                if (action in availableRoutes) {
                    activeRoutes[action] = availableRoutes[action];
                }
            });
        }
        // 2. except
        else if (params.except) {
            if (typeof params.except === 'string') {
                params.except = [params.except];
            }
            for (var action1 in availableRoutes) {
                if (params.except.indexOf(action1) === -1) {
                    activeRoutes[action1] = availableRoutes[action1];
                }
            }
        }
        // 3. all
        else {
            for (var action2 in availableRoutes) {
                activeRoutes[action2] = availableRoutes[action2];
            }
        }

        return activeRoutes;
    }
775540
function (url) {
		var current = this.current, params = current.params;

		var state = find(url);

		if (state.is_changed(current.name, params)) {
			this.current = state;
			this.trigger_event("state_changed", state);
			this.trigger_event("state_changed_success", url);
		}
	}
238287
function (e) {
        if (e && e.prevValue === e.newValue) {
            return;
        }

        var par   = this.current ? this.current.parentNode : null,
            after = this.link;

        if (par) {
            switch (this.paginator.getTotalPages()) {
                case Paginator.VALUE_UNLIMITED :
                        after = this.na; break;
                case this.paginator.getCurrentPage() :
                        after = this.span; break;
            }

            if (this.current !== after) {
                par.replaceChild(after,this.current);
                this.current = after;
            }
        }
    }
309658
public function getCurrentRoute()
    {
        if (isset($this->currentRoute)) {
            return $this->currentRoute;
        } elseif (! $this->hasDispatchedRoutes()) {
            return null;
        }

        $request = $this->container['request'];

        return $this->currentRoute = $this->createRoute($request->route());
    }
226190
function(req) {
        var args = utils.arg2arr(arguments), index = -1;
        var allHandlers = this._handlers.concat(this._lastHandlers);
        var next = function(error) {
            var item = allHandlers[++index];
            if (item) {
                var matched = false;
                if (utils.isString(item.routeExp)) {
                    matched = req.url.indexOf(item.routeExp) === 0;
                } else if (utils.type(item.routeExp) === 'regexp') {
                    matched = item.routeExp.test(parse(req.url).pathname);
                }
                //
                if (matched) {
                    var clone = args.concat();
                    if (error) { clone.push(error); }
                    item.handler.apply(null, clone);
                }
            }
        };
        args.push(next);
        next();
    }
1193414
function advanceActivatedRoute(route) {
    if (route.snapshot) {
        var currentSnapshot = route.snapshot;
        var nextSnapshot = route._futureSnapshot;
        route.snapshot = nextSnapshot;
        if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {
            route.queryParams.next(nextSnapshot.queryParams);
        }
        if (currentSnapshot.fragment !== nextSnapshot.fragment) {
            route.fragment.next(nextSnapshot.fragment);
        }
        if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {
            route.params.next(nextSnapshot.params);
        }
        if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {
            route.url.next(nextSnapshot.url);
        }
        if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {
            route.data.next(nextSnapshot.data);
        }
    }
    else {
        route.snapshot = route._futureSnapshot;
        // this is for resolved data
        route.data.next(route._futureSnapshot.data);
    }
}
822231
public void collectRouteStats(String route, int statusCode) {

        // increments 200, 301, 401, 503, etc. status counters
        final String preciseStatusString = String.format("status_%d", statusCode);
        NamedCountingMonitor preciseStatus = namedStatusMap.get(preciseStatusString);
        if (preciseStatus == null) {
            preciseStatus = new NamedCountingMonitor(preciseStatusString);
            NamedCountingMonitor found = namedStatusMap.putIfAbsent(preciseStatusString, preciseStatus);
            if (found != null) preciseStatus = found;
            else MonitorRegistry.getInstance().registerObject(preciseStatus);
        }
        preciseStatus.increment();

        // increments 2xx, 3xx, 4xx, 5xx status counters
        final String summaryStatusString = String.format("status_%dxx", statusCode / 100);
        NamedCountingMonitor summaryStatus = namedStatusMap.get(summaryStatusString);
        if (summaryStatus == null) {
            summaryStatus = new NamedCountingMonitor(summaryStatusString);
            NamedCountingMonitor found = namedStatusMap.putIfAbsent(summaryStatusString, summaryStatus);
            if (found != null) summaryStatus = found;
            else MonitorRegistry.getInstance().registerObject(summaryStatus);
        }
        summaryStatus.increment();

        // increments route and status counter
        if (route == null) route = "ROUTE_NOT_FOUND";
        route = route.replace("/", "_");
        ConcurrentHashMap<Integer, RouteStatusCodeMonitor> statsMap = routeStatusMap.get(route);
        if (statsMap == null) {
            statsMap = new ConcurrentHashMap<Integer, RouteStatusCodeMonitor>();
            routeStatusMap.putIfAbsent(route, statsMap);
        }
        RouteStatusCodeMonitor sd = statsMap.get(statusCode);
        if (sd == null) {
            //don't register only 404 status codes (these are garbage endpoints)
            if (statusCode == 404) {
                if (statsMap.size() == 0) {
                    return;
                }
            }

            sd = new RouteStatusCodeMonitor(route, statusCode);
            RouteStatusCodeMonitor sd1 = statsMap.putIfAbsent(statusCode, sd);
            if (sd1 != null) {
                sd = sd1;
            } else {
                MonitorRegistry.getInstance().registerObject(sd);
            }
        }
        sd.update();
    }
667681
function() {
    var current = $state.current();

    if(current && current.url) {
      var path;
      path = current.url;

      // Add parameters or use default parameters
      var params = current.params || {};
      var query = {};
      for(var name in params) {
        var re = new RegExp(':'+name, 'g');
        if(path.match(re)) {
          path = path.replace(re, params[name]);
        } else {
          query[name] = params[name];
        }
      }

      $location.path(path);
      $location.search(query);
      
      _url = $location.url();
    }
  }