summaryrefslogtreecommitdiff
path: root/lib/string_decoder.js
diff options
context:
space:
mode:
authorAntoine du Hamel <duhamelantoine1995@gmail.com>2020-11-21 20:23:32 +0100
committerJames M Snell <jasnell@gmail.com>2020-12-07 09:59:42 -0800
commit4027e36dfd9b9a44ba6a6efec8a7c0dd57cde4e9 (patch)
treef523bea33ab00b12a47bd1bed53522859c12ee37 /lib/string_decoder.js
parent7e5fc9c792f1aefef1a832b0bf03a06c661aebd4 (diff)
downloadnode-new-4027e36dfd9b9a44ba6a6efec8a7c0dd57cde4e9.tar.gz
string_decoder: refactor to use more primordials
PR-URL: https://github.com/nodejs/node/pull/36358 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/string_decoder.js')
-rw-r--r--lib/string_decoder.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/string_decoder.js b/lib/string_decoder.js
index 3d2cc2fcb6..2891e0a1d1 100644
--- a/lib/string_decoder.js
+++ b/lib/string_decoder.js
@@ -25,6 +25,7 @@ const {
ArrayBufferIsView,
ObjectDefineProperties,
Symbol,
+ TypedArrayPrototypeSubarray,
} = primordials;
const { Buffer } = require('buffer');
@@ -104,8 +105,9 @@ ObjectDefineProperties(StringDecoder.prototype, {
configurable: true,
enumerable: true,
get() {
- return this[kNativeDecoder].subarray(kIncompleteCharactersStart,
- kIncompleteCharactersEnd);
+ return TypedArrayPrototypeSubarray(this[kNativeDecoder],
+ kIncompleteCharactersStart,
+ kIncompleteCharactersEnd);
}
},
lastNeed: {