Module base module

module url

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, the supported fields are: protocol, slashes, username, password, hostname, port, pathname, query,hash

Return result:

  • String, returns the 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 to be parsed
  • parseQueryString: Boolean, specifies whether to parse the 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 the parsed data


Combine 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