code: 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)
  }
docs: Returns true if the given pathname matches the active routes
  and params.