更新 url 路径

@inner
@param {string} url 要更新的 url
@return {string}
 /*function updateUrl(url) {
if (url && amdHelper.isLocalPath(url)) {
return url.replace(SRC_REGEXP, '$1' + RELEASE_DIR + '$2');
}
return url;
}
486226
function getAmdConfig() {
    var amdConfig = fis.config.get('amd') || {};
    var requireConfig = {};
    ['baseUrl', 'paths', 'packages', 'shim'].forEach(function (key) {
        amdConfig[key] && (requireConfig[key] = amdConfig[key]);
    });
    return requireConfig;
}
793810
function (url) {
                if (!url)
                    return "";

                var urlParts = url.split("/"),
                    newPath = "";

                for (var i = 0, len = urlParts.length; i < len; i++) {
                    var part = urlParts[i];

                    if (!part || part.length === 0
                        || part.indexOf(":") != -1
                        || part === "."
                        || part === ".."
                        || part === "null"
                        || part === "undefined") {
                        continue;
                    }

                    if (newPath.length !== 0) {
                        newPath = newPath + "/";
                    }

                    newPath = newPath + part;
                }

                return newPath;
            }
902502
function fresh (url, parsedUrl) {
  return typeof parsedUrl === 'object' &&
    parsedUrl !== null &&
    (Url === undefined || parsedUrl instanceof Url) &&
    parsedUrl._raw === url
}
719996
public static function url($url, $replace = true) {
        static $alias = false, $defaultModule = false;
        if ($alias === false) {
            if (defined('ALIAS_ENABLED') && ALIAS_ENABLED) {
                $aliasFile = MODULES_PATH . 'alias.php';
                if (is_file($aliasFile)) {
                    $alias = (array)include $aliasFile;
                } else {
                    $alias = [];
                }
            } else {
                $alias = [];
            }
        }
        if ($defaultModule === false) {
            if (defined('DEFAULT_MODULE')) {
                $defaultModule = self::id2dir(DEFAULT_MODULE);
            } else {
                $defaultModule = null;
            }
        }
        if (is_array($url)) {
            $host    = $url[0];
            $url     = $url[1];
            $replace = false;
        }
        $url  = trim($url, '/');
        $urls = explode('/', $url);

        if ($replace) {//将url中的id替换成dir
            if (preg_match('/^([~!@#%\^&\*])(.+)$/', $urls[0], $ms)) {
                $urls[0] = $ms[1] . App::id2dir($ms[2]);
            } else {
                if (($host = App::getModuleDomain($urls[0]))) {
                    $urls[0] = '';
                } else {
                    $urls[0] = App::id2dir($urls[0]);
                }
            }
        }
        if (self::$prefix) {
            $urls[0] = preg_replace_callback('/^([~!@#%\^&\*])/', function ($ms) {
                if (isset(self::$prefix['map'][ $ms[1] ])) {
                    return self::$prefix['map'][ $ms[1] ];
                }

                return $ms[0];
            }, $urls[0]);
        }
        $rurl = ltrim(str_replace('//', '/', implode('/', $urls)), '/');
        if (isset($host) && $host) {
            return $host . WWWROOT_DIR . $rurl;
        } else {
            //检测默认模块
            if ($defaultModule && preg_match("#^$defaultModule#", $rurl)) {
                //去掉默认模块路径
                $rurl = trim(substr($rurl, strlen($defaultModule)), '/');
            }

            //检测别名
            if ($rurl) {
                $key = array_search($rurl, $alias);
                if ($key) {
                    $rurl = trim($key, '/');
                }
            }

            return WWWROOT_DIR . $rurl;
        }
    }
76344
function getUri(url) {
    let uriObj = url_opera.parse(url);

    let uri = url;
    let hostname = uriObj.hostname;
    let ip = config.hosts && config.hosts[hostname];

    // 如果有hosts的配置，且有对应域名的IP，则更改uri中的域名为IP
    if (ip) {
      let protocol = uriObj.protocol + '//';

      uri = url.replace(protocol + hostname, protocol + ip);
    }

    return {
      uri: uri,
      hostname: hostname,
      host: uriObj.host
    }
  }
843443
function(url) {
      if (!isSupportHistoryAPI && ('' + url).indexOf('#') === 0) {
        changeState(null, url, true);
      } else {
        windowLocation.replace(url);
      }
    }
252026
function(url, params, onsuccess, onfail) {
    // url中包含 get 参数和 params 合并
    if (_typeof(params) == 'object') params = _params_2_url(params);
    else params = '';

    if (params) url = url + '?' + params;
    return request('GET', url, '', onsuccess, onfail);
  }
696739
public static Map<String, String> parseUrl(String url) {
        Map<String, String> result = new HashMap<>(8);
        result.put(PROTOCOL_KEY, ValueConsts.EMPTY_STRING);
        result.put(HOST_KEY, ValueConsts.EMPTY_STRING);
        result.put(PATH_KEY, ValueConsts.EMPTY_STRING);
        if (Checker.isNotEmpty(url)) {
            String[] pros;
            final String protocolSplit = "://";
            if (url.contains(protocolSplit)) {
                pros = url.split(protocolSplit);
            } else {
                pros = new String[]{"", url};
            }
            // 设置主机、协议、路径
            result.put(PROTOCOL_KEY, pros[0]);
            if (pros.length < ValueConsts.TWO_INT) {
                pros = new String[]{pros[0], ValueConsts.EMPTY_STRING};
            }
            if (pros[1].contains(ValueConsts.SPLASH_STRING)) {
                int lastIndex = pros[1].lastIndexOf(ValueConsts.SPLASH_STRING);
                if (pros[1].startsWith(ValueConsts.SPLASH_STRING)) {
                    // 文件协议
                    result.put(PATH_KEY, pros[1].substring(1));
                } else if (pros[1].contains(ValueConsts.SPLASH_STRING)) {
                    int index = pros[1].indexOf("/");
                    // 设置主机
                    result.put(HOST_KEY, pros[1].substring(0, index));
                    // 设置参数
                    if (pros[1].contains(ValueConsts.QUESTION_MARK)) {
                        lastIndex = pros[1].indexOf(ValueConsts.QUESTION_MARK);
                        String[] params = pros[1].split("\\?")[1].split("&");
                        for (String param : params) {
                            String[] kv = param.split("=");
                            result.put(kv[0], kv[1]);
                        }
                    }
                    // 设置路径
                    if (lastIndex > index) {
                        String path = pros[1].substring(index + 1, lastIndex);
                        path = path.endsWith(ValueConsts.SPLASH_STRING) ? path.substring(0, path.length() - 1) : path;
                        result.put(PATH_KEY, path);
                    }
                } else {
                    result.put(HOST_KEY, pros[1]);
                }
            } else {
                result.put(HOST_KEY, pros[1]);
            }
        }
        return result;
    }
819769
function resolveUrl(url){
    
    // replace all // except the one in proto with /
    url = url.replace(reDoubleSlash, "$1/");
    
    // If the url is a valid url we do nothing
    if (!url.match(/^(http||https):\/\//)) {
        // If this is a relative path
        var path = (url.substring(0, 1) === "/") ? "" : location.pathname;
        if (path.substring(path.length - 1) !== "/") {
            path = path.substring(0, path.lastIndexOf("/") + 1);
        }
        
        url = location.protocol + "//" + location.host + path + url;
    }
    
    // reduce all 'xyz/../' to just '' 
    while (reParent.test(url)) {
        url = url.replace(reParent, "");
    }
    
    return url;
}
689796
function UrlNode(data){
    this.append = function(next){
        this.next = next;
    };
    this.getData = function(){
        return this.data;
    };
    this.setData = function(data){
        this.data = data;
    }
    this.getNext = function(){
        return this.next;
    };
    this.setParams = function(params){
        var queryParameters = params.split("&");
        if(queryParameters != null){
            this.params = [];
            for(var counter = 0; counter < queryParameters.length; counter++) {
                var keyValuePair = queryParameters[counter].split("=");
                this.params[keyValuePair[0]] = keyValuePair[1];
            }
        } else{
            queryParameters = null;
        }
    };
    this.getParams = function(){
        return this.params;
    };

    //set var's for this object
    var queryParamSplit = data.split("?");
    this.params = null;
    this.data = null;
    this.next = null;
    if(queryParamSplit != null && queryParamSplit.length > 1){
        this.setData(queryParamSplit[0]);
        this.setParams(queryParamSplit[1]);
    } else{
        this.setData(data);
    }
}
539117
function updateDownloadLink( anchor, objectUrl, fileName ) {
    if ( window.updateDownloadLinkIe11 ) {
        return window.updateDownloadLinkIe11( ...arguments );
    }
    anchor.setAttribute( 'href', objectUrl || '' );
    anchor.setAttribute( 'download', fileName || '' );
}
616654
function getUrl (url) {
  var opt = {
    url: url
  , timeout: 10000 // 10 seconds
  }
  ;
  return new Promise(function(resolve, reject){
    request(opt, function(err, res, body){
      if (err) { return reject(err); }
      resolve(body)
    });
  });
}
76916
public static URL url(String url, URLStreamHandler handler) {
		Assert.notNull(url, "URL must not be null");

		// 兼容Spring的ClassPath路径
		if (url.startsWith(CLASSPATH_URL_PREFIX)) {
			url = url.substring(CLASSPATH_URL_PREFIX.length());
			return ClassLoaderUtil.getClassLoader().getResource(url);
		}

		try {
			return new URL(null, url, handler);
		} catch (MalformedURLException e) {
			// 尝试文件路径
			try {
				return new File(url).toURI().toURL();
			} catch (MalformedURLException ex2) {
				throw new UtilException(e);
			}
		}
	}
348519
function (url) {
      return $.Deferred(function (deferred) {
        var $img = $('<img>');

        $img.one('load', function () {
          $img.off('error abort');
          deferred.resolve($img);
        }).one('error abort', function () {
          $img.off('load').detach();
          deferred.reject($img);
        }).css({
          display: 'none'
        }).appendTo(document.body).attr('src', url);
      }).promise();
    }
385780
function parseURL(s) {
  var url = null;
  try {
    url = new URL(s);
  } catch (error) {
    console.error(error);
  }
  return url;
}
1281839
function (urlpath, dir) {
    var dirarr = dir.split('/');
    var url = /\/$/.test(urlpath) ? urlpath : urlpath + '/';
    dirarr.forEach(function (val) {
        addOneDir(url, val);
        redirectTo(url + val + '/');
        url += val;
    });
}
926080
function userUpdate (args, user, type = 'create') {
  if (!this.attributes.includes('createdUsr') || !this.attributes.includes('updatedUsr')) {
    return args
  }

  if (_.isEmpty(user)) {
    throw new Error('未登录')
  } else {
    user = user.id || user
  }

  if (_.isArray(args)) {
    args.forEach(arg => {
      arg.updatedUsr = user
      if (type === 'create') {
        arg.createdUsr = user
      }
    })
  }

  if (_.isObject(args) && !_.isArray(args)) {
    args.updatedUsr = user
    if (type === 'create') {
      args.createdUsr = user
    }
  }

  return args
}