Skip to content

Commit 9221406

Browse files
LiviaMedeirosaduh95
authored andcommitted
doc: use global TextDecoder and TextEncoder instead of util
Signed-off-by: LiviaMedeiros <livia@cirno.name> PR-URL: #67461 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
1 parent 5e297a0 commit 9221406

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

‎doc/api/intl.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ programs. Some of them are:
2020
* The [WHATWG URL parser][]'s [internationalized domain names][] (IDNs) support
2121
* [`require('node:buffer').transcode()`][]
2222
* More accurate [REPL][] line editing
23-
* [`require('node:util').TextDecoder`][]
23+
* [`TextDecoder`][]
2424
* [`RegExp` Unicode Property Escapes][]
2525

2626
Node.js and the underlying V8 engine use
@@ -57,7 +57,7 @@ option:
5757
| [WHATWG URL Parser][] | partial (no IDN support) | full | full | full |
5858
| [`require('node:buffer').transcode()`][] | none (function does not exist) | full | full | full |
5959
| [REPL][] | partial (inaccurate line editing) | full | full | full |
60-
| [`require('node:util').TextDecoder`][] | partial (basic encodings support) | partial/full (depends on OS) | partial (Unicode-only) | full |
60+
| [`TextDecoder`][] | partial (basic encodings support) | partial/full (depends on OS) | partial (Unicode-only) | full |
6161
| [`RegExp` Unicode Property Escapes][] | none (invalid `RegExp` error) | full | full | full |
6262

6363
The "(not locale-aware)" designation denotes that the function carries out its
@@ -231,8 +231,8 @@ to be helpful:
231231
[`String.prototype.normalize()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
232232
[`String.prototype.toLowerCase()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase
233233
[`String.prototype.toUpperCase()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
234+
[`TextDecoder`]: globals.md#class-textdecoder
234235
[`require('node:buffer').transcode()`]: buffer.md#buffertranscodesource-fromenc-toenc
235-
[`require('node:util').TextDecoder`]: util.md#class-utiltextdecoder
236236
[btest402]: https://github.com/srl295/btest402
237237
[full-icu]: https://www.npmjs.com/package/full-icu
238238
[internationalized domain names]: https://en.wikipedia.org/wiki/Internationalized_domain_name

‎doc/api/module.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ not possible to replace the value of a Node.js builtin (core) module.
10361036
* The specific {TypedArray} object is a {Uint8Array}.
10371037
10381038
If the source value of a text-based format (i.e., `'json'`, `'module'`)
1039-
is not a string, it is converted to a string using [`util.TextDecoder`][].
1039+
is not a string, it is converted to a string using [`TextDecoder`][].
10401040
10411041
### Examples
10421042
@@ -1413,6 +1413,7 @@ returned object contains the following keys:
14131413
[`NODE_V8_COVERAGE=dir`]: cli.md#node_v8_coveragedir
14141414
[`Object.freeze()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
14151415
[`SourceMap`]: #class-modulesourcemap
1416+
[`TextDecoder`]: globals.md#class-textdecoder
14161417
[`module.constants.compileCacheStatus`]: #moduleconstantscompilecachestatus
14171418
[`module.enableCompileCache()`]: #moduleenablecompilecacheoptions
14181419
[`module.flushCompileCache()`]: #moduleflushcompilecache
@@ -1421,7 +1422,6 @@ returned object contains the following keys:
14211422
[`module.registerHooks()`]: #moduleregisterhooksoptions
14221423
[`module.setSourceMapsSupport()`]: #modulesetsourcemapssupportenabled-options
14231424
[`os.tmpdir()`]: os.md#ostmpdir
1424-
[`util.TextDecoder`]: util.md#class-utiltextdecoder
14251425
[accepted final formats]: #accepted-final-formats-returned-by-load
14261426
[deregistration of customization hooks]: #deregistration-of-customization-hooks
14271427
[hook functions]: #hook-functions-accepted-by-moduleregisterhooks

‎doc/api/webstreams.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,6 @@ added: v16.7.0
16341634
```mjs
16351635
import { arrayBuffer } from 'node:stream/consumers';
16361636
import { Readable } from 'node:stream';
1637-
import { TextEncoder } from 'node:util';
16381637

16391638
const encoder = new TextEncoder();
16401639
const dataArray = encoder.encode('hello world from consumers!');
@@ -1648,7 +1647,6 @@ console.log(`from readable: ${data.byteLength}`);
16481647
```cjs
16491648
const { arrayBuffer } = require('node:stream/consumers');
16501649
const { Readable } = require('node:stream');
1651-
const { TextEncoder } = require('node:util');
16521650

16531651
const encoder = new TextEncoder();
16541652
const dataArray = encoder.encode('hello world from consumers!');

0 commit comments

Comments
 (0)