doc: addresses nits in string_decoder, url, util
- Only `@@toStringTag` affects `util.isError()`, this is the reason why it uses `Object.prototype.toString.call(argument)` under the hood. - Shows an actual Euro symbol for reference. - Uses line-drawing characters for the URL chart & fixes the chart borders. PR-URL: https://github.com/nodejs/node/pull/7026 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
parent
67368d8553
commit
0cc903544d
@ -28,8 +28,8 @@ internal buffer is used to ensure that the decoded string does not contain
|
|||||||
any incomplete multibyte characters. These are held in the buffer until the
|
any incomplete multibyte characters. These are held in the buffer until the
|
||||||
next call to `stringDecoder.write()` or until `stringDecoder.end()` is called.
|
next call to `stringDecoder.write()` or until `stringDecoder.end()` is called.
|
||||||
|
|
||||||
In the following example, the three UTF-8 encoded bytes of the European euro
|
In the following example, the three UTF-8 encoded bytes of the European Euro
|
||||||
symbol are written over three separate operations:
|
symbol (`€`) are written over three separate operations:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const StringDecoder = require('string_decoder').StringDecoder;
|
const StringDecoder = require('string_decoder').StringDecoder;
|
||||||
|
@ -20,17 +20,17 @@ The following details each of the components of a parsed URL. The example
|
|||||||
illustrate each.
|
illustrate each.
|
||||||
|
|
||||||
```
|
```
|
||||||
+---------------------------------------------------------------------------+
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
||||||
| href |
|
│ href │
|
||||||
+----------++-----------+-----------------+-------------------------+-------+
|
├──────────┬┬───────────┬─────────────────┬───────────────────────────┬───────┤
|
||||||
| protocol || auth | host | path | hash |
|
│ protocol ││ auth │ host │ path │ hash │
|
||||||
| || +----------+------+----------+--------------+ |
|
│ ││ ├──────────┬──────┼──────────┬────────────────┤ │
|
||||||
| || | hostname | port | pathname | search | |
|
│ ││ │ hostname │ port │ pathname │ search │ │
|
||||||
| || | | | +-+------------+ |
|
│ ││ │ │ │ ├─┬──────────────┤ │
|
||||||
| || | | | | | query | |
|
│ ││ │ │ │ │ │ query │ │
|
||||||
" http: // user:pass @ host.com : 8080 /p/a/t/h ? query=string #hash "
|
" http: // user:pass @ host.com : 8080 /p/a/t/h ? query=string #hash "
|
||||||
| || | | | | | | |
|
│ ││ │ │ │ │ │ │ │
|
||||||
+----------++-----------+-----------+------+----------+-+-----------+-------+
|
└──────────┴┴───────────┴──────────┴──────┴──────────┴─┴──────────────┴───────┘
|
||||||
(all spaces in the "" line should be ignored -- they're purely for formatting)
|
(all spaces in the "" line should be ignored -- they're purely for formatting)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ util.isError({ name: 'Error', message: 'an error occurred' });
|
|||||||
|
|
||||||
Note that this method relies on `Object.prototype.toString()` behavior. It is
|
Note that this method relies on `Object.prototype.toString()` behavior. It is
|
||||||
possible to obtain an incorrect result when the `object` argument manipulates
|
possible to obtain an incorrect result when the `object` argument manipulates
|
||||||
the `@@toStringTag` or overrides the `toString()` method.
|
`@@toStringTag`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user