Skip to content

Commit a15addc

Browse files
aduh95danielleadams
authored andcommitted
string_decoder: refactor to use more primordials
PR-URL: #36358 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f73a0a8 commit a15addc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/string_decoder.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const {
2525
ArrayBufferIsView,
2626
ObjectDefineProperties,
2727
Symbol,
28+
TypedArrayPrototypeSubarray,
2829
} = primordials;
2930

3031
const { Buffer } = require('buffer');
@@ -104,8 +105,9 @@ ObjectDefineProperties(StringDecoder.prototype, {
104105
configurable: true,
105106
enumerable: true,
106107
get() {
107-
return this[kNativeDecoder].subarray(kIncompleteCharactersStart,
108-
kIncompleteCharactersEnd);
108+
return TypedArrayPrototypeSubarray(this[kNativeDecoder],
109+
kIncompleteCharactersStart,
110+
kIncompleteCharactersEnd);
109111
}
110112
},
111113
lastNeed: {

0 commit comments

Comments
 (0)