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 danielleadams committed Dec 7, 2020
1 parent f73a0a8 commit a15addc
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 a15addc

Please sign in to comment.