remove escape character `|` from `url`
160623
def unescape(url):
    '''
    
    '''
    scheme = urlparse(url).scheme
    if not scheme:
        return url.lstrip('|')
    elif scheme == 'salt':
        path, saltenv = parse(url)
        if salt.utils.platform.is_windows() and '|' in url:
            return create(path.lstrip('_'), saltenv)
        else:
            return create(path.lstrip('|'), saltenv)
    else:
        return url
1034938
function (url) {
            var tmp = url.replace(/\burl\s*/gi, "");    // removing url word
            tmp = tmp.charAt(0) === "(" ? tmp.substring(1, tmp.length - 1) : tmp; // removing brackets
            tmp = tmp.charAt(0) === "\'" || tmp.charAt(0) === "\"" ? tmp.substring(1, tmp.length - 1) : tmp; // removing quotes
            return tmp;
        }
1171322
function regEscape(str) {
  // essentially stolen from https://github.com/component/escape-regexp with a modified replacer
  return String(str).replace(/([.*+?=^!:${}()|[\]\/\\])/g, function (match, paren, index, orig) {
    if (match === ':' && orig[index + 1] !== '/')
      return match;
    
    // if star, it's a wildcard if only enclosed by forward slashes (or at start or end of string)
    if (match === '*' && (index === 0 || orig[index - 1] === '/') && (index + 1 === orig.length || orig[index + 1] === '/'))
      return '.*';
    
    return '\\' + match;
  });
}
859916
def escape_path(str)
      result = ""
      str.scan(%r{/([^/]*)}).each{|i|
        result << "/" << _escape(i[0], UNESCAPED_PCHAR)
      }
      return result
    end
907722
function sanitize(str, len) {
    len = len || 256;
    if (!str || typeof str === 'string' && str.length < 1)
        return str;
    if (typeof str !== 'string' || str.length > len)
        return null;
    return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
        switch (char) {
            case "\0":
                return "\\0";
            case "\x08":
                return "\\b";
            case "\x09":
                return "\\t";
            case "\x1a":
                return "\\z";
            case "\n":
                return "\\n";
            case "\r":
                return "\\r";
            case "\"":
            case "'":
            case "\\":
            case "%":
                return "\\" + char; // prepends a backslash to backslash, percent,
            // and double/single quotes
        }
    });
}
1373437
function normalizeUrl(url) {
  if (!IS_ABSOLUTE.test(url)) {
    return (0, _normalizeUrl2['default'])(url).replace('http://', '');
  } else {
    return (0, _normalizeUrl2['default'])(url);
  }
}
292349
def clean_url(url, force_scheme=None):
    """"""
    # URL should be ASCII according to RFC 3986
    url = str(url)
    # Collapse ../../ and related
    url_parts = urlparse.urlparse(url)
    path_parts = []
    for part in url_parts.path.split('/'):
        if part == '.':
            continue
        elif part == '..':
            if path_parts:
                path_parts.pop()
        else:
            path_parts.append(part)

    url_parts = list(url_parts)
    if force_scheme:
        url_parts[0] = force_scheme
    url_parts[2] = '/'.join(path_parts)

    if FLAGS.keep_query_string == False:
        url_parts[4] = ''    # No query string

    url_parts[5] = ''    # No path

    # Always have a trailing slash
    if not url_parts[2]:
        url_parts[2] = '/'

    return urlparse.urlunparse(url_parts)
222859
function normalizePath(urlPath) {
  if (!urlPath) {
    return '';
  // make sure path starts with a /
  } else if (_.head(urlPath) !== '/') {
    urlPath = '/' + urlPath;
  }
  // make sure path does not end with a /
  return _.trimEnd(urlPath, '/');
}
843628
def clean_url(url, base_url=None):
    """"""
    parsed_url = urlparse(url)

    fragment = '{url.fragment}'.format(url=parsed_url)
    if fragment:
        url = url.split(fragment)[0]

    # Identify internal URLs and fix their format
    netloc = '{url.netloc}'.format(url=parsed_url)
    if base_url is not None and not netloc:
        parsed_base = urlparse(base_url)
        split_base = '{url.scheme}://{url.netloc}{url.path}/'.format(url=parsed_base)
        url = urljoin(split_base, url)
        netloc = '{url.netloc}'.format(url=urlparse(url))

    if 'www.' in netloc:
        url = url.replace(netloc, netloc.replace('www.', ''))
    return url.rstrip(string.punctuation)
846055
def remove_slashes(url)
      return url unless url.present? && url.include?('//')
      parts = url.split('//')
      return parts[0..1].join if parts.length > 2
      url
    end
495540
function( string ) {
		return ( string || '' ).replace( ramp, "&amp;" )
			.replace( rquote, "&quot;" )
			.replace( rsquote, "&#039;" )
			.replace( rlt, "&lt;" )
			.replace( rgt, "&gt;" );
	}
1214925
private String getValidURL(String url)
	{
		if (url != null && url.length() > 0)
		{
			// XXX really important that this one happens first!!
			return url.replaceAll("[%]", "%25")
				.replaceAll(" ", "%20")
				.replaceAll("[<]", "%3c")
				.replaceAll("[>]", "%3e")
				.replaceAll("[\"]", "%3f")
			.replaceAll("[#]", "%23")
			.replaceAll("[{]", "%7b")
			.replaceAll("[}]", "%7d")
			.replaceAll("[|]", "%7c")
			.replaceAll("[\\\\]", "%5c") // double check this
													// one :-)
			.replaceAll("[\\^]", "%5e")
			.replaceAll("[~]", "%7e")
			.replaceAll("[\\[]", "%5b")
			.replaceAll("[\\]]", "%5d")
			.replaceAll("[']", "%27")
			.replaceAll("[?]", "%3f");
		}

		return url;

	}
678028
function(url) {
            url = (url || '').replace(/\#.*?$/, '');
            url = url.replace('?pjax=true&', '?').replace('?pjax=true', '').replace('&pjax=true', '');
            return url;
        }
841687
def clean_url(url):
        """"""
        if not url.startswith(('http://', 'https://')):
            url = f'http://{url}'

        if not URL_RE.match(url):
            raise BadURLException(f'{url} is not valid')

        return url
1279707
def is_escaped(url):
    '''
    
    '''
    scheme = urlparse(url).scheme
    if not scheme:
        return url.startswith('|')
    elif scheme == 'salt':
        path, saltenv = parse(url)
        if salt.utils.platform.is_windows() and '|' in url:
            return path.startswith('_')
        else:
            return path.startswith('|')
    else:
        return False
1353167
def url_quote(s, charset='utf-8', safe='/:'):
    
    if isinstance(s, unicode):
        s = s.encode(charset)
    elif not isinstance(s, str):
        s = str(s)
    return _quote(s, safe=safe)
30608
function(u){
      var urlObj = url.parse(u)
      return u.replace( urlObj.search, '').replace('#', '')
    }