module-url
url processing module
object
URL
CreateUrlObjectrequest object, seeUrlObject
1UrlObject url.URL;
static function
format
parameter constructionUrlObjectobject
1static 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
parse a url string
1
2
3static 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
resolve
Merge relative paths into one absolute path
1
2static 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