diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2018-04-29 20:46:41 +0300 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2018-05-03 02:12:07 +0300 |
commit | 7588ceaf353af0f257d4d832bace4600edac704e (patch) | |
tree | cd01b69085d5c1134c43e61d8acc84586d1a188d /doc/api/url.md | |
parent | bdf5be98dd901f6c312938198439dbda0b20d517 (diff) | |
download | node-new-7588ceaf353af0f257d4d832bace4600edac704e.tar.gz |
doc: add more missing backticks
Also, fix some other nits in passing
(formatting, punctuation, typos, redundancy, obsoleteness).
PR-URL: https://github.com/nodejs/node/pull/20438
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'doc/api/url.md')
-rw-r--r-- | doc/api/url.md | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/doc/api/url.md b/doc/api/url.md index a7add464e8..64b7b444c5 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -86,8 +86,8 @@ The `URL` class is also available on the global object. In accordance with browser conventions, all properties of `URL` objects are implemented as getters and setters on the class prototype, rather than as -data properties on the object itself. Thus, unlike [legacy urlObject][]s, using -the `delete` keyword on any properties of `URL` objects (e.g. `delete +data properties on the object itself. Thus, unlike [legacy `urlObject`][]s, +using the `delete` keyword on any properties of `URL` objects (e.g. `delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still return `true`. @@ -346,7 +346,7 @@ console.log(myURL.port); // Prints 1234 ``` -The port value may be set as either a number or as a String containing a number +The port value may be set as either a number or as a string containing a number in the range `0` to `65535` (inclusive). Setting the value to the default port of the `URL` objects given `protocol` will result in the `port` value becoming the empty string (`''`). @@ -581,7 +581,7 @@ added: v7.10.0 * `iterable` {Iterable} An iterable object whose elements are key-value pairs Instantiate a new `URLSearchParams` object with an iterable map in a way that -is similar to [`Map`][]'s constructor. `iterable` can be an Array or any +is similar to [`Map`][]'s constructor. `iterable` can be an `Array` or any iterable object. That means `iterable` can be another `URLSearchParams`, in which case the constructor will simply create a clone of the provided `URLSearchParams`. Elements of `iterable` are key-value pairs, and can @@ -644,16 +644,16 @@ Remove all name-value pairs whose name is `name`. * Returns: {Iterator} -Returns an ES6 Iterator over each of the name-value pairs in the query. -Each item of the iterator is a JavaScript Array. The first item of the Array -is the `name`, the second item of the Array is the `value`. +Returns an ES6 `Iterator` over each of the name-value pairs in the query. +Each item of the iterator is a JavaScript `Array`. The first item of the `Array` +is the `name`, the second item of the `Array` is the `value`. Alias for [`urlSearchParams[@@iterator]()`][`urlSearchParams@@iterator()`]. #### urlSearchParams.forEach(fn[, thisArg]) -* `fn` {Function} Function invoked for each name-value pair in the query. -* `thisArg` {Object} Object to be used as `this` value for when `fn` is called +* `fn` {Function} Invoked for each name-value pair in the query +* `thisArg` {Object} To be used as `this` value for when `fn` is called Iterates over each name-value pair in the query and invokes the given function. @@ -695,7 +695,7 @@ Returns `true` if there is at least one name-value pair whose name is `name`. * Returns: {Iterator} -Returns an ES6 Iterator over the names of each name-value pair. +Returns an ES6 `Iterator` over the names of each name-value pair. ```js const params = new URLSearchParams('foo=bar&foo=baz'); @@ -760,15 +760,15 @@ percent-encoded where necessary. * Returns: {Iterator} -Returns an ES6 Iterator over the values of each name-value pair. +Returns an ES6 `Iterator` over the values of each name-value pair. #### urlSearchParams\[Symbol.iterator\]() * Returns: {Iterator} -Returns an ES6 Iterator over each of the name-value pairs in the query string. -Each item of the iterator is a JavaScript Array. The first item of the Array -is the `name`, the second item of the Array is the `value`. +Returns an ES6 `Iterator` over each of the name-value pairs in the query string. +Each item of the iterator is a JavaScript `Array`. The first item of the `Array` +is the `name`, the second item of the `Array` is the `value`. Alias for [`urlSearchParams.entries()`][]. @@ -846,7 +846,7 @@ added: v7.6.0 Punycode encoded. **Default:** `false`. * Returns: {string} -Returns a customizable serialization of a URL String representation of a +Returns a customizable serialization of a URL `String` representation of a [WHATWG URL][] object. The URL object has both a `toString()` method and `href` property that return @@ -871,9 +871,9 @@ console.log(url.format(myURL, { fragment: false, unicode: true, auth: false })); ## Legacy URL API -### Legacy urlObject +### Legacy `urlObject` -The legacy urlObject (`require('url').Url`) is created and returned by the +The legacy `urlObject` (`require('url').Url`) is created and returned by the `url.parse()` function. #### urlObject.auth @@ -1039,7 +1039,7 @@ The formatting process operates as follows: `urlObject.host` is coerced to a string and appended to `result`. * If the `urlObject.pathname` property is a string that is not an empty string: * If the `urlObject.pathname` *does not start* with an ASCII forward slash - (`/`), then the literal string '/' is appended to `result`. + (`/`), then the literal string `'/'` is appended to `result`. * The value of `urlObject.pathname` is appended to `result`. * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an [`Error`][] is thrown. @@ -1205,6 +1205,6 @@ console.log(myURL.origin); [WHATWG URL Standard]: https://url.spec.whatwg.org/ [WHATWG URL]: #url_the_whatwg_url_api [examples of parsed URLs]: https://url.spec.whatwg.org/#example-url-parsing -[legacy urlObject]: #url_legacy_urlobject +[legacy `urlObject`]: #url_legacy_urlobject [percent-encoded]: #whatwg-percent-encoding [stable sorting algorithm]: https://en.wikipedia.org/wiki/Sorting_algorithm#Stability |