File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -56,12 +56,7 @@ const {
5656 decodeUTF8,
5757} = internalBinding ( 'buffer' ) ;
5858
59- let Buffer ;
60- function lazyBuffer ( ) {
61- if ( Buffer === undefined )
62- Buffer = require ( 'buffer' ) . Buffer ;
63- return Buffer ;
64- }
59+ const { Buffer } = require ( 'buffer' ) ;
6560
6661function validateEncoder ( obj ) {
6762 if ( obj == null || obj [ kEncoder ] !== true )
@@ -499,14 +494,14 @@ function makeTextDecoderJS() {
499494 validateDecoder ( this ) ;
500495 if ( isAnyArrayBuffer ( input ) ) {
501496 try {
502- input = lazyBuffer ( ) . from ( input ) ;
497+ input = Buffer . from ( input ) ;
503498 } catch {
504499 input = empty ;
505500 }
506501 } else if ( isArrayBufferView ( input ) ) {
507502 try {
508- input = lazyBuffer ( ) . from ( input . buffer , input . byteOffset ,
509- input . byteLength ) ;
503+ input = Buffer . from ( input . buffer , input . byteOffset ,
504+ input . byteLength ) ;
510505 } catch {
511506 input = empty ;
512507 }
You can’t perform that action at this time.
0 commit comments