Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ffb4087

Browse filesBrowse files
chichiwangMylesBorins
authored andcommitted
src: remove function hasTextDecoder in encoding.js
also... return TextDecoder directly from factories PR-URL: #23625 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent b3e1205 commit ffb4087
Copy full SHA for ffb4087

File tree

Expand file treeCollapse file tree

1 file changed

+4
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-11
lines changed
Open diff view settings
Collapse file

‎lib/internal/encoding.js‎

Copy file name to clipboardExpand all lines: lib/internal/encoding.js
+4-11Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -341,22 +341,16 @@ Object.defineProperties(
341341
value: 'TextEncoder'
342342
} });
343343

344-
const { hasConverter, TextDecoder } =
344+
const TextDecoder =
345345
process.binding('config').hasIntl ?
346346
makeTextDecoderICU() :
347347
makeTextDecoderJS();
348348

349-
function hasTextDecoder(encoding = 'utf-8') {
350-
validateArgument(encoding, 'string', 'encoding', 'string');
351-
return hasConverter(getEncodingFromLabel(encoding));
352-
}
353-
354349
function makeTextDecoderICU() {
355350
const {
356351
decode: _decode,
357352
getConverter,
358-
hasConverter
359-
} = process.binding('icu');
353+
} = internalBinding('icu');
360354

361355
class TextDecoder {
362356
constructor(encoding = 'utf-8', options = {}) {
@@ -409,7 +403,7 @@ function makeTextDecoderICU() {
409403
}
410404
}
411405

412-
return { hasConverter, TextDecoder };
406+
return TextDecoder;
413407
}
414408

415409
function makeTextDecoderJS() {
@@ -497,7 +491,7 @@ function makeTextDecoderJS() {
497491
}
498492
}
499493

500-
return { hasConverter, TextDecoder };
494+
return TextDecoder;
501495
}
502496

503497
// Mix in some shared properties.
@@ -552,7 +546,6 @@ function makeTextDecoderJS() {
552546

553547
module.exports = {
554548
getEncodingFromLabel,
555-
hasTextDecoder,
556549
TextDecoder,
557550
TextEncoder
558551
};

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.