@@ -190,7 +190,7 @@ function WritableState(options, stream, isDuplex) {
190190}
191191
192192WritableState . prototype . getBuffer = function getBuffer ( ) {
193- var current = this . bufferedRequest ;
193+ let current = this . bufferedRequest ;
194194 const out = [ ] ;
195195 while ( current ) {
196196 out . push ( current ) ;
@@ -201,7 +201,7 @@ WritableState.prototype.getBuffer = function getBuffer() {
201201
202202// Test _writableState for inheritance to account for Duplex streams,
203203// whose prototype chain only points to Readable.
204- var realHasInstance ;
204+ let realHasInstance ;
205205if ( typeof Symbol === 'function' && SymbolHasInstance ) {
206206 realHasInstance = FunctionPrototype [ SymbolHasInstance ] ;
207207 ObjectDefineProperty ( Writable , SymbolHasInstance , {
@@ -351,7 +351,7 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) {
351351 state . needDrain = true ;
352352
353353 if ( state . writing || state . corked || state . errored ) {
354- var last = state . lastBufferedRequest ;
354+ const last = state . lastBufferedRequest ;
355355 state . lastBufferedRequest = {
356356 chunk,
357357 encoding,
@@ -424,7 +424,7 @@ function onwrite(stream, er) {
424424 }
425425 } else {
426426 // Check if we're actually ready to finish, but don't emit yet
427- var finished = needFinish ( state ) || stream . destroyed ;
427+ const finished = needFinish ( state ) || stream . destroyed ;
428428
429429 if ( ! finished &&
430430 ! state . corked &&
@@ -495,17 +495,17 @@ function errorBuffer(state, err) {
495495// If there's something in the buffer waiting, then process it
496496function clearBuffer ( stream , state ) {
497497 state . bufferProcessing = true ;
498- var entry = state . bufferedRequest ;
498+ let entry = state . bufferedRequest ;
499499
500500 if ( stream . _writev && entry && entry . next ) {
501501 // Fast case, write everything using _writev()
502- var l = state . bufferedRequestCount ;
503- var buffer = new Array ( l ) ;
504- var holder = state . corkedRequestsFree ;
502+ const l = state . bufferedRequestCount ;
503+ const buffer = new Array ( l ) ;
504+ const holder = state . corkedRequestsFree ;
505505 holder . entry = entry ;
506506
507- var count = 0 ;
508- var allBuffers = true ;
507+ let count = 0 ;
508+ let allBuffers = true ;
509509 while ( entry ) {
510510 buffer [ count ] = entry ;
511511 if ( entry . encoding !== 'buffer' )
@@ -525,18 +525,18 @@ function clearBuffer(stream, state) {
525525 state . corkedRequestsFree = holder . next ;
526526 holder . next = null ;
527527 } else {
528- var corkReq = { next : null , entry : null , finish : undefined } ;
528+ const corkReq = { next : null , entry : null , finish : undefined } ;
529529 corkReq . finish = onCorkedFinish . bind ( undefined , corkReq , state ) ;
530530 state . corkedRequestsFree = corkReq ;
531531 }
532532 state . bufferedRequestCount = 0 ;
533533 } else {
534534 // Slow case, write chunks one-by-one
535535 while ( entry ) {
536- var chunk = entry . chunk ;
537- var encoding = entry . encoding ;
538- var cb = entry . callback ;
539- var len = state . objectMode ? 1 : chunk . length ;
536+ const chunk = entry . chunk ;
537+ const encoding = entry . encoding ;
538+ const cb = entry . callback ;
539+ const len = state . objectMode ? 1 : chunk . length ;
540540
541541 doWrite ( stream , state , false , len , chunk , encoding , cb ) ;
542542 entry = entry . next ;
@@ -692,10 +692,10 @@ function endWritable(stream, state, cb) {
692692}
693693
694694function onCorkedFinish ( corkReq , state , err ) {
695- var entry = corkReq . entry ;
695+ let entry = corkReq . entry ;
696696 corkReq . entry = null ;
697697 while ( entry ) {
698- var cb = entry . callback ;
698+ const cb = entry . callback ;
699699 state . pendingcb -- ;
700700 cb ( err ) ;
701701 entry = entry . next ;
0 commit comments