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 @@ -57,12 +57,7 @@ const {
5757 decodeUTF8,
5858} = internalBinding ( 'buffer' ) ;
5959
60- let Buffer ;
61- function lazyBuffer ( ) {
62- if ( Buffer === undefined )
63- Buffer = require ( 'buffer' ) . Buffer ;
64- return Buffer ;
65- }
60+ const { Buffer } = require ( 'buffer' ) ;
6661
6762function validateEncoder ( obj ) {
6863 if ( obj == null || obj [ kEncoder ] !== true )
@@ -517,14 +512,14 @@ function makeTextDecoderJS() {
517512 validateDecoder ( this ) ;
518513 if ( isAnyArrayBuffer ( input ) ) {
519514 try {
520- input = lazyBuffer ( ) . from ( input ) ;
515+ input = Buffer . from ( input ) ;
521516 } catch {
522517 input = empty ;
523518 }
524519 } else if ( isArrayBufferView ( input ) ) {
525520 try {
526- input = lazyBuffer ( ) . from ( input . buffer , input . byteOffset ,
527- input . byteLength ) ;
521+ input = Buffer . from ( input . buffer , input . byteOffset ,
522+ input . byteLength ) ;
528523 } catch {
529524 input = empty ;
530525 }
You can’t perform that action at this time.
0 commit comments