@@ -13,37 +13,51 @@ string will not be in the parsed object. Examples are shown for the URL
13
13
14
14
* ` href ` : The full URL that was originally parsed. Both the protocol and host are lowercased.
15
15
16
- Example:
` 'http://user:[email protected] :8080/p/a/t/h?query=string#hash' `
16
+ Example:
` 'http://user:[email protected] :8080/p/a/t/h?query=string#hash' `
17
+
17
18
* ` protocol ` : The request protocol, lowercased.
18
19
19
- Example: ` 'http:' `
20
- * ` host ` : The full lowercased host portion of the URL, including port and authentication information.
20
+ Example: ` 'http:' `
21
+
22
+ * ` host ` : The full lowercased host portion of the URL, including port
23
+ information.
24
+
25
+ Example: ` 'host.com:8080' `
21
26
22
- Example:
` 'user:[email protected] :8080' `
23
27
* ` auth ` : The authentication information portion of a URL.
24
28
25
- Example: ` 'user:pass' `
29
+ Example: ` 'user:pass' `
30
+
26
31
* ` hostname ` : Just the lowercased hostname portion of the host.
27
32
28
- Example: ` 'host.com' `
33
+ Example: ` 'host.com' `
34
+
29
35
* ` port ` : The port number portion of the host.
30
36
31
- Example: ` '8080' `
32
- * ` pathname ` : The path section of the URL, that comes after the host and before the query, including the initial slash if present.
37
+ Example: ` '8080' `
33
38
34
- Example: ` '/p/a/t/h' `
35
- * ` search ` : The 'query string' portion of the URL, including the leading question mark.
39
+ * ` pathname ` : The path section of the URL, that comes after the host and
40
+ before the query, including the initial slash if present.
41
+
42
+ Example: ` '/p/a/t/h' `
43
+
44
+ * ` search ` : The 'query string' portion of the URL, including the leading
45
+ question mark.
46
+
47
+ Example: ` '?query=string' `
36
48
37
- Example: ` '?query=string' `
38
49
* ` path ` : Concatenation of ` pathname ` and ` search ` .
39
50
40
- Example: ` '/p/a/t/h?query=string' `
41
- * ` query ` : Either the 'params' portion of the query string, or a querystring-parsed object.
51
+ Example: ` '/p/a/t/h?query=string' `
52
+
53
+ * ` query ` : Either the 'params' portion of the query string, or a
54
+ querystring-parsed object.
55
+
56
+ Example: ` 'query=string' ` or ` {'query':'string'} `
42
57
43
- Example: ` 'query=string' ` or ` {'query':'string'} `
44
58
* ` hash ` : The 'fragment' portion of the URL including the pound-sign.
45
59
46
- Example: ` '#hash' `
60
+ Example: ` '#hash' `
47
61
48
62
The following methods are provided by the URL module:
49
63
@@ -65,9 +79,11 @@ Take a parsed URL object, and return a formatted URL string.
65
79
66
80
* ` href ` will be ignored.
67
81
* ` protocol ` is treated the same with or without the trailing ` : ` (colon).
68
- * The protocols ` http ` , ` https ` , ` ftp ` , ` gopher ` , ` file ` will be postfixed with ` :// ` (colon-slash-slash).
69
- * All other protocols ` mailto ` , ` xmpp ` , ` aim ` , ` sftp ` , ` foo ` , etc will be postfixed with ` : ` (colon)
70
- * ` auth ` will only be used if ` host ` is absent.
82
+ * The protocols ` http ` , ` https ` , ` ftp ` , ` gopher ` , ` file ` will be
83
+ postfixed with ` :// ` (colon-slash-slash).
84
+ * All other protocols ` mailto ` , ` xmpp ` , ` aim ` , ` sftp ` , ` foo ` , etc will
85
+ be postfixed with ` : ` (colon)
86
+ * ` auth ` will be used if present.
71
87
* ` hostname ` will only be used if ` host ` is absent.
72
88
* ` port ` will only be used if ` host ` is absent.
73
89
* ` host ` will be used in place of ` auth ` , ` hostname ` , and ` port `
@@ -79,4 +95,5 @@ Take a parsed URL object, and return a formatted URL string.
79
95
80
96
## url.resolve(from, to)
81
97
82
- Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.
98
+ Take a base URL, and a href URL, and resolve them as a browser would for
99
+ an anchor tag.
0 commit comments