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: nodejs#36358
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
aduh95 authored and cjihrig committed Dec 8, 2020
1 parent 5ff1b77 commit a13319a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/string_decoder.js
Original file line number Diff line number Diff line change
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 a13319a

Please sign in to comment.