Module basic module


url processing module



CreateUrlObjectrequest object, seeUrlObject

UrlObject url.URL;

static function


parameter constructionUrlObjectobject

static String url.format(Object args);

Call parameters:

  • args: Object, a dictionary object specifying construction parameters, supported fields are: protocol, slashes, username, password, hostname, port, pathname, query,hash

return result:

  • String, returns a successfully constructed string


parse a url string

1 2 3
static UrlObject url.parse(String url, Boolean parseQueryString = false, Boolean slashesDenoteHost = false);

Call parameters:

  • url: String, specifies the url string that needs to be parsed
  • parseQueryString: Boolean, specifies whether to parse query
  • slashesDenoteHost: Boolean, the default is false, if set to true, the string from the string '//' to the next '/' will be parsed as host, such as '//foo/bar', the result should be { host: 'foo', pathname: '/bar'} instead of {pathname: '//foo/bar'}

return result:

  • UrlObject, returns an object containing parsed data


Merge relative paths into one absolute path

1 2
static String url.resolve(String _from, String to);

Call parameters:

  • _from: String, source path
  • to: String, relative path

return result:

  • String, returns the resulting absolute path