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>
This commit is contained in:
Antoine du Hamel authored and Danielle Adams committed 2020-12-07 13:55:52 -05:00
1 parent f73a0a8069
commit a15addc153
1 file changed
+4 -2
+4 -2
View File
@@ -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: {