replace everything in a route but the pathname and hash
198503
function pathname (routename, isElectron) {
  if (isElectron) routename = routename.replace(stripElectron, '')
  else routename = routename.replace(prefix, '')
  return decodeURI(routename.replace(suffix, '').replace(normalize, '/'))
}
299058
function generatePath(route, params) {
    return route.pattern.replace(nameOrSplatParam, function(_, name) { return params[name]; });
  }
290381
function(route) {
      route = route.replace(escapeRegExp, '\\$&')
                   .replace(optionalParam, '(?:$1)?')
                   .replace(namedParam, function(match, optional){
                     return optional ? match : '([^\/]+)';
                   })
                   .replace(splatParam, '(.*?)');
      return new RegExp('^' + route + '$');
    }
492986
function(route) 
	{
		var rootStripper 	= /^\/+|\/+$/g;
		var optionalParam 	= /\((.*?)\)/g;
		var namedParam		= /(\(\?)?:\w+/g;
		var splatParam		= /\*\w+/g;
		var escapeRegExp	= /[\-{}\[\]+?.,\\\^$|#\s]/g;
		
		route = route
			.replace(rootStripper, '')
			.replace(escapeRegExp, '\\$&')
			.replace(optionalParam, '(?:$1)?')
			.replace(namedParam, function(match, optional)
			{
				return optional ? match : '([^\/]+)';
			})
			.replace(splatParam, '(.*?)');
		
		return new RegExp('^' + route + '$');
	}
999623
function normalize(route) {
  const normalized = { ...route };

  if (is.not.array(normalized.path) && is.not.string(normalized.path)) {
    throw new Error("The route's path must be a String or [String]");
  }

  if (is.array(normalized.method)) {
    /* If method is an array */
    for (let method of normalized.method) {
      method = clean(method);
    }
  }

  /* If method is a string */
  if (is.string(normalized.method)) {
    normalized.method = clean(normalized.method);
  }

  return normalized;
}
331533
def patch(path, options = {}, &block)
      perform_request Net::HTTP::Patch, path, options, &block
    end
828053
def yank_path(self, path):
        """"""
        for func in self._caches:
            cache = {}
            for key in self._caches[func].keys():
                log.debug("cache key %s for func %s", key, func)
                if path in key[0]:
                    log.debug("del cache key %s", key)
                    del self._caches[func][key]
630905
function (path, replace, replacement) {
    var _path = path.replace(replace, replacement).replace(new RegExp('/{2,}', 'giu'), '/');
    return _path !== '' ? _path : '/'
  }
1268532
function reparsePath(oldpath) {
        if (oldpath.indexOf("?") >= 0) {
            var vars = oldpath.split("?")[1].split("&");
            var result = oldpath.split("?")[0] + '?';
            var firstFlag = 0;
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if (ignoredParams.search(pair[0]) < 0) {
                    if (firstFlag === 0) {
                        result = result + pair[0] + '=' + pair[1];
                        firstFlag = 1;
                    }
                    else {
                        result = result + '&' + pair[0] + '=' + pair[1];
                    }
                }
            }
            return result;
        }
        else {
            return oldpath;
        }
    }
473615
def replace_hash_at_path(hash, key, value)
      path = JsonPath.new(key).path
      if !value.nil?
        # REVIEW: Is there a better way to parse the JSON Path and ensure
        # a value at the location?
        (0...(path.length - 1)).each do |i|
          eval("hash#{path[0..i].join('')} ||= {}")
        end
        eval("hash#{path.join('')} = #{value.inspect}")
      elsif JsonPath.new(key).on(hash).count > 0
        # Path value is present, but we need to unset it
        leaf_key = eval(path[-1]).first
        eval("hash#{path[0...-1].join('')}.delete(#{leaf_key.inspect})")
      end

      hash
    end
1232014
def set_as_path_prepend
      arr = []
      match = config_get('route_map', 'set_as_path_prepend', @get_args)
      if arr
        match.each do |line|
          next if line.include?('last-as')
          arr = line.strip.split
        end
      end
      arr
    end
905990
def path_mapped(script_name, *args)
    return cleanup_paths("/#{script_name}/#{@locations[:root]}") if args.empty?
    a = replace_symbols(script_name, *args)
    cleanup_paths("/#{script_name}/#{@locations[:root]}/#{a.join('/')}")
  end
751288
function applyPaths(loader, name) {
  // most specific (most number of slashes in path) match wins
  var pathMatch = '', wildcard, maxWildcardPrefixLen = 0;

  var paths = loader.paths;
  var pathsCache = loader._loader.paths;

  // check to see if we have a paths entry
  for (var p in paths) {
    if (paths.hasOwnProperty && !paths.hasOwnProperty(p))
      continue;

    // paths sanitization
    var path = paths[p];
    if (path !== pathsCache[p])
      path = paths[p] = pathsCache[p] = urlResolve(paths[p], isRel(paths[p]) ? baseURI : loader.baseURL);

    // exact path match
    if (p.indexOf('*') === -1) {
      if (name == p)
        return paths[p];
      
      // support trailing / in paths rules
      else if (name.substr(0, p.length - 1) == p.substr(0, p.length - 1) && (name.length < p.length || name[p.length - 1] == p[p.length - 1]) && (paths[p][paths[p].length - 1] == '/' || paths[p] == '')) {
        return paths[p].substr(0, paths[p].length - 1) + (name.length > p.length ? (paths[p] && '/' || '') + name.substr(p.length) : '');
      }
    }
    // wildcard path match
    else {
      var pathParts = p.split('*');
      if (pathParts.length > 2)
        throw new TypeError('Only one wildcard in a path is permitted');

      var wildcardPrefixLen = pathParts[0].length;
      if (wildcardPrefixLen >= maxWildcardPrefixLen &&
          name.substr(0, pathParts[0].length) == pathParts[0] &&
          name.substr(name.length - pathParts[1].length) == pathParts[1]) {
            maxWildcardPrefixLen = wildcardPrefixLen;
            pathMatch = p;
            wildcard = name.substr(pathParts[0].length, name.length - pathParts[1].length - pathParts[0].length);
          }
    }
  }

  var outPath = paths[pathMatch];
  if (typeof wildcard == 'string')
    outPath = outPath.replace('*', wildcard);

  return outPath;
}
321385
function mapAllNames(path) {
    log("[%s] Mapping %s", self.parentModuleName, path);
    fs.readdirSync(path).forEach(function(p){
      var absPath = PATH.resolve(path+PATH.sep+p);
      var lstat = fs.lstatSync(absPath);

      if(lstat.isFile() && isModule(p)) {
        var name = getModuleName(p);
        self.updateNameCache(name, absPath);
      } else if(! isIgnoreFolder(p) && lstat.isDirectory()) {
        mapAllNames(absPath);
      }
    });

    function isIgnoreFolder(folderName) {
      return !folderName || folderName === 'node_modules' || folderName[0] === '.';
    }

    function isModule(p) {
      return p.match(/\.(js|json)$/);
    }

    function getModuleName(p) {
      return p.replace(/\.(js|json)$/, '');
    }
  }
660718
function redirect() {
    l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + repo + '/?' +
      (l.pathname ? 'p=' + l.pathname.replace(/&/g, '~and~').replace(repo, '') : '') +
      (l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
      (l.hash))
  }
532984
function routePath (route) {
  if (!route) return ''
  return route.path || (route.regexp && route.regexp.source) || ''
}
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)
}