You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 10, 2021. It is now read-only.
Parse a query string into an object. Leading ? or # are ignored, so you can pass location.search or location.hash directly.
212
+
Parse a query string into an object.
212
213
From [querystring/parse](https://nodejs.org/api/querystring.html#querystring_querystring_parse_str_sep_eq_options)
213
214
214
215
@@ -219,11 +220,11 @@ From [querystring/parse](https://nodejs.org/api/querystring.html#querystring_que
219
220
| Name | Type | Description ||
220
221
| ---- | ---- | ----------- | -------- |
221
222
| str |`string`| The URL query string to parse. | |
222
-
| sep='&'|`string`| The substring used to delimit key and value pairs in the query string. Defaults to '&'. |*Optional*|
223
-
| eq='='|`string`| The substring used to delimit keys and values in the query string. Defaults to '='. |*Optional*|
223
+
| sep='&'|`string`| The substring to delimit key and value pairs. |*Optional*|
224
+
| eq='='|`string`| The substring to delimit keys and values. |*Optional*|
224
225
| options |`Object`||*Optional*|
225
-
| options.decodeURIComponent=querystring.unescape() |`Function`| The function to use when decoding percent-encoded characters in the query string. |*Optional*|
226
-
| options.maxKeys=1000 |`Function`|Specifies the maximum number of keys to parse. Defaults to 1000. Specify 0 to remove key counting limitations. |*Optional*|
226
+
| options.decodeURIComponent=querystring.unescape() |`Function`| The decoding function. |*Optional*|
227
+
| options.maxKeys=1000 |`Function`|Maximum number of keys to parse. 0 to remove key counting limitations. |*Optional*|
Parse a query string into an object. Leading ? or # are ignored, so you can pass location.search or location.hash directly.
244
-
From [querystring/parse](https://nodejs.org/api/querystring.html#querystring_querystring_parse_str_sep_eq_options)
245
+
From [url/parse](https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost)
245
246
246
247
247
248
@@ -251,23 +252,32 @@ From [querystring/parse](https://nodejs.org/api/querystring.html#querystring_que
251
252
| Name | Type | Description ||
252
253
| ---- | ---- | ----------- | -------- |
253
254
| urlString |`string`| The URL string to parse. | |
254
-
| parseQueryString=false |`boolean`|If true, the query property will always be set to an object returned by the querystring module's parse() method. If false, the query property on the returned URL object will be an unparsed, undecoded string. |*Optional*|
255
-
| slashesDenoteHost=false |`boolean`|If true, the first token after the literal string // and preceding the next / will be interpreted as the host. For instance, given //foo/bar, the result would be {host: 'foo', pathname: '/bar'} rather than {pathname: '//foo/bar'}. |*Optional*|
255
+
| parseQueryString=false |`boolean`|The query property will be set to an object returned by the querystring module's parse() method if `true`. |*Optional*|
256
+
| slashesDenoteHost=false |`boolean`|The first token after the literal string // and preceding the next / will be interpreted as the host if `true`. |*Optional*|
-`Object` Returns the parsed URL into a collection of key and value pairs.
269
-
-`TypeError` A TypeError is thrown if urlString is not a string.
270
-
-`URIError` A URIError is thrown if the auth property is present but cannot be decoded.
271
281
272
282
<aid="hasAnsi"></a>
273
283
## hasAnsi(input)
@@ -695,10 +705,10 @@ From [querystring/stringify](https://nodejs.org/api/querystring.html#querystring
695
705
| Name | Type | Description ||
696
706
| ---- | ---- | ----------- | -------- |
697
707
| str |`string`| The URL query string to parse. | |
698
-
| sep='&'|`string`| The substring used to delimit key and value pairs in the query string. Defaults to '&'. |*Optional*|
699
-
| eq='='|`string`| The substring used to delimit keys and values in the query string. Defaults to '='. |*Optional*|
708
+
| sep='&'|`string`| The substring to delimit key and value pairs. |*Optional*|
709
+
| eq='='|`string`| The substring to delimit keys and values. |*Optional*|
700
710
| options |`Object`||*Optional*|
701
-
| options.decodeURIComponent=querystring.unescape() |`Function`| The function to use when decoding percent-encoded characters in the query string. |*Optional*|
711
+
| options.decodeURIComponent=querystring.unescape() |`Function`| The decoding function. |*Optional*|
702
712
703
713
704
714
##### Examples
@@ -767,6 +777,36 @@ toUpper('abc');
767
777
##### Returns
768
778
-`string` Returns the upper case version of `str`.
769
779
780
+
<aid="toURL"></a>
781
+
## toURL(urlObject)
782
+
Convert an url object to URL.
783
+
From [url/format](https://nodejs.org/api/url.html#url_url_format_urlobject)
784
+
785
+
786
+
787
+
788
+
##### Parameters
789
+
790
+
| Name | Type | Description ||
791
+
| ---- | ---- | ----------- | -------- |
792
+
| urlObject |`Object``string`| A URL object (as returned by url.parse() or constructed otherwise). If a string, it is converted to an object by passing it to url.parse(). | |
Copy file name to clipboardexpand all lines: fromQuery.js
+5-5
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
/**
2
-
* Parse a query string into an object. Leading ? or # are ignored, so you can pass location.search or location.hash directly.
2
+
* Parse a query string into an object.
3
3
* From [querystring/parse](https://nodejs.org/api/querystring.html#querystring_querystring_parse_str_sep_eq_options)
4
4
* @static
5
5
* @param {string} str The URL query string to parse.
6
-
* @param {string} [sep='&'] The substring used to delimit key and value pairs in the query string. Defaults to '&'.
7
-
* @param {string} [eq='='] The substring used to delimit keys and values in the query string. Defaults to '='.
6
+
* @param {string} [sep='&'] The substring to delimit key and value pairs.
7
+
* @param {string} [eq='='] The substring to delimit keys and values.
8
8
* @param {Object} [options]
9
-
* @param {Function} [options.decodeURIComponent=querystring.unescape()] The function to use when decoding percent-encoded characters in the query string.
10
-
* @param {Function} [options.maxKeys=1000] Specifies the maximum number of keys to parse. Defaults to 1000. Specify 0 to remove key counting limitations.
9
+
* @param {Function} [options.decodeURIComponent=querystring.unescape()] The decoding function.
10
+
* @param {Function} [options.maxKeys=1000] Maximum number of keys to parse. 0 to remove key counting limitations.
11
11
* @returns {Object} Returns the parsed URL query string (str) into a collection of key and value pairs.
* Parse a query string into an object. Leading ? or # are ignored, so you can pass location.search or location.hash directly.
3
+
* From [url/parse](https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost)
4
+
* @static
5
+
* @param {string} urlString The URL string to parse.
6
+
* @param {boolean} [parseQueryString=false] The query property will be set to an object returned by the querystring module's parse() method if `true`.
7
+
* @param {boolean} [slashesDenoteHost=false] The first token after the literal string // and preceding the next / will be interpreted as the host if `true`.
8
+
* @returns {Object} Returns the parsed URL into a collection of key and value pairs.
Copy file name to clipboardexpand all lines: toQuery.js
+3-3
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,10 @@
3
3
* From [querystring/stringify](https://nodejs.org/api/querystring.html#querystring_querystring_stringify_obj_sep_eq_options)
4
4
* @static
5
5
* @param {string} str The URL query string to parse.
6
-
* @param {string} [sep='&'] The substring used to delimit key and value pairs in the query string. Defaults to '&'.
7
-
* @param {string} [eq='='] The substring used to delimit keys and values in the query string. Defaults to '='.
6
+
* @param {string} [sep='&'] The substring to delimit key and value pairs.
7
+
* @param {string} [eq='='] The substring to delimit keys and values.
8
8
* @param {Object} [options]
9
-
* @param {Function} [options.decodeURIComponent=querystring.unescape()] The function to use when decoding percent-encoded characters in the query string.
9
+
* @param {Function} [options.decodeURIComponent=querystring.unescape()] The decoding function.
10
10
* @returns {Object} Returns the parsed URL query string (str) into a collection of key and value pairs.
* From [url/format](https://nodejs.org/api/url.html#url_url_format_urlobject)
4
+
* @static
5
+
* @param {Object|string} urlObject A URL object (as returned by url.parse() or constructed otherwise). If a string, it is converted to an object by passing it to url.parse().
0 commit comments