diff options
author | James M Snell <jasnell@gmail.com> | 2018-08-12 11:55:13 -0700 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-09-17 17:09:25 +0200 |
commit | 932be0164fb3ed869ae3ddfff391721d2fd8e1af (patch) | |
tree | 4eb32dfe566fa20fe9bc6a7f265122c57dab61f6 /doc | |
parent | efe0bbcd2fde5f60546fa2dc60295956ba440a3c (diff) | |
download | android-node-v8-932be0164fb3ed869ae3ddfff391721d2fd8e1af.tar.gz android-node-v8-932be0164fb3ed869ae3ddfff391721d2fd8e1af.tar.bz2 android-node-v8-932be0164fb3ed869ae3ddfff391721d2fd8e1af.zip |
util: make TextEncoder/TextDecoder global
Fixes: https://github.com/nodejs/node/issues/20365
PR-URL: https://github.com/nodejs/node/pull/22281
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/errors.md | 4 | ||||
-rw-r--r-- | doc/api/globals.md | 21 | ||||
-rw-r--r-- | doc/api/util.md | 15 |
3 files changed, 38 insertions, 2 deletions
diff --git a/doc/api/errors.md b/doc/api/errors.md index 34d85d0ceb..7e77d84ed0 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -794,13 +794,13 @@ The stack trace is extended to include the point in time at which the <a id="ERR_ENCODING_INVALID_ENCODED_DATA"></a> ### ERR_ENCODING_INVALID_ENCODED_DATA -Data provided to `util.TextDecoder()` API was invalid according to the encoding +Data provided to `TextDecoder()` API was invalid according to the encoding provided. <a id="ERR_ENCODING_NOT_SUPPORTED"></a> ### ERR_ENCODING_NOT_SUPPORTED -Encoding provided to `util.TextDecoder()` API was not one of the +Encoding provided to `TextDecoder()` API was not one of the [WHATWG Supported Encodings][]. <a id="ERR_FALSY_VALUE_REJECTION"></a> diff --git a/doc/api/globals.md b/doc/api/globals.md index a9aaefeefa..af0bf3ee67 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -138,6 +138,25 @@ added: v0.0.1 [`setTimeout`] is described in the [timers][] section. +## TextDecoder +<!-- YAML +added: REPLACEME +--> + +<!-- type=global --> + +The WHATWG `TextDecoder` class. See the [`TextDecoder`][] section. + +## TextEncoder +<!-- YAML +added: REPLACEME +--> + +<!-- type=global --> + +The WHATWG `TextEncoder` class. See the [`TextEncoder`][] section. + + ## URL <!-- YAML added: v10.0.0 @@ -169,6 +188,8 @@ The WHATWG `URLSearchParams` class. See the [`URLSearchParams`][] section. [`setImmediate`]: timers.html#timers_setimmediate_callback_args [`setInterval`]: timers.html#timers_setinterval_callback_delay_args [`setTimeout`]: timers.html#timers_settimeout_callback_delay_args +[`TextDecoder`]: util.html#util_class_util_textdecoder +[`TextEncoder`]: util.html#util_class_util_textencoder [`URL`]: url.html#url_class_url [`URLSearchParams`]: url.html#url_class_urlsearchparams [buffer section]: buffer.html diff --git a/doc/api/util.md b/doc/api/util.md index d29fbfc5b7..267bab85ae 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -878,6 +878,13 @@ The `'iso-8859-16'` encoding listed in the [WHATWG Encoding Standard][] is not supported. ### new TextDecoder([encoding[, options]]) +<!-- YAML +added: v8.3.0 +changes: + - version: REPLACEME + pr-url: REPLACEME + description: The class is now available on the global object. +--> * `encoding` {string} Identifies the `encoding` that this `TextDecoder` instance supports. **Default:** `'utf-8'`. @@ -893,6 +900,8 @@ is not supported. Creates an new `TextDecoder` instance. The `encoding` may specify one of the supported encodings or an alias. +The `TextDecoder` class is also available on the global object. + ### textDecoder.decode([input[, options]]) * `input` {ArrayBuffer|DataView|TypedArray} An `ArrayBuffer`, `DataView` or @@ -932,6 +941,10 @@ mark. ## Class: util.TextEncoder <!-- YAML added: v8.3.0 +changes: + - version: REPLACEME + pr-url: REPLACEME + description: The class is now available on the global object. --> An implementation of the [WHATWG Encoding Standard][] `TextEncoder` API. All @@ -942,6 +955,8 @@ const encoder = new TextEncoder(); const uint8array = encoder.encode('this is some data'); ``` +The `TextEncoder` class is also available on the global object. + ### textEncoder.encode([input]) * `input` {string} The text to encode. **Default:** an empty string. |