File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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 ) {
6762if ( obj == null || obj [ kEncoder ] !== true )
@@ -499,14 +494,14 @@ function makeTextDecoderJS() {
499494validateDecoder ( this ) ;
500495if ( isAnyArrayBuffer ( input ) ) {
501496try {
502- input = lazyBuffer ( ) . from ( input ) ;
497+ input = Buffer . from ( input ) ;
503498} catch {
504499input = empty ;
505500}
506501} else if ( isArrayBufferView ( input ) ) {
507502try {
508- input = lazyBuffer ( ) . from ( input . buffer , input . byteOffset ,
509- input . byteLength ) ;
503+ input = Buffer . from ( input . buffer , input . byteOffset ,
504+ input . byteLength ) ;
510505} catch {
511506input = empty ;
512507}
You can’t perform that action at this time.
0 commit comments