Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChi-chi Wang <chichi@wangchiyi.com>2018-10-12 21:32:55 +0300
committerJames M Snell <jasnell@gmail.com>2018-10-16 20:08:22 +0300
commit25dc25b1111a9bdb8b60064eb0afe73873e96b83 (patch)
tree406f7df6e1bc2752e8c51ba3ca8a50a80a1842c2 /lib/internal/encoding.js
parentdeaddd212c499c7ff88d20034753b5f3f00d5153 (diff)
src: remove function hasTextDecoder in encoding.js
also... return TextDecoder directly from factories PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'lib/internal/encoding.js')
-rw-r--r--lib/internal/encoding.js13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js
index 77eca99202d..ce3cc7411a6 100644
--- a/lib/internal/encoding.js
+++ b/lib/internal/encoding.js
@@ -341,21 +341,15 @@ Object.defineProperties(
value: 'TextEncoder'
} });
-const { hasConverter, TextDecoder } =
+const TextDecoder =
process.binding('config').hasIntl ?
makeTextDecoderICU() :
makeTextDecoderJS();
-function hasTextDecoder(encoding = 'utf-8') {
- validateArgument(encoding, 'string', 'encoding', 'string');
- return hasConverter(getEncodingFromLabel(encoding));
-}
-
function makeTextDecoderICU() {
const {
decode: _decode,
getConverter,
- hasConverter
} = internalBinding('icu');
class TextDecoder {
@@ -409,7 +403,7 @@ function makeTextDecoderICU() {
}
}
- return { hasConverter, TextDecoder };
+ return TextDecoder;
}
function makeTextDecoderJS() {
@@ -497,7 +491,7 @@ function makeTextDecoderJS() {
}
}
- return { hasConverter, TextDecoder };
+ return TextDecoder;
}
// Mix in some shared properties.
@@ -552,7 +546,6 @@ function makeTextDecoderJS() {
module.exports = {
getEncodingFromLabel,
- hasTextDecoder,
TextDecoder,
TextEncoder
};