Skip to content

Commit

Permalink
string_decoder: refactor to use more primordials
Browse files Browse the repository at this point in the history
PR-URL: #36358
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
aduh95 authored and targos committed Jun 11, 2021
1 parent ff546ff commit 0db9101
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/string_decoder.js
Expand Up @@ -25,6 +25,7 @@ const {
ArrayBufferIsView,
ObjectDefineProperties,
Symbol,
TypedArrayPrototypeSubarray,
} = primordials;

const { Buffer } = require('buffer');
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 0db9101

Please sign in to comment.