@@ -187,7 +187,7 @@ function WritableState(options, stream, isDuplex) {
187187}
188188
189189WritableState . prototype . getBuffer = function getBuffer ( ) {
190- var current = this . bufferedRequest ;
190+ let current = this . bufferedRequest ;
191191 const out = [ ] ;
192192 while ( current ) {
193193 out . push ( current ) ;
@@ -205,7 +205,7 @@ ObjectDefineProperty(WritableState.prototype, 'buffer', {
205205
206206// Test _writableState for inheritance to account for Duplex streams,
207207// whose prototype chain only points to Readable.
208- var realHasInstance ;
208+ let realHasInstance ;
209209if ( typeof Symbol === 'function' && SymbolHasInstance ) {
210210 realHasInstance = FunctionPrototype [ SymbolHasInstance ] ;
211211 ObjectDefineProperty ( Writable , SymbolHasInstance , {
@@ -357,7 +357,7 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) {
357357 state . needDrain = true ;
358358
359359 if ( state . writing || state . corked || state . errored ) {
360- var last = state . lastBufferedRequest ;
360+ const last = state . lastBufferedRequest ;
361361 state . lastBufferedRequest = {
362362 chunk,
363363 encoding,
@@ -428,7 +428,7 @@ function onwrite(stream, er) {
428428 }
429429 } else {
430430 // Check if we're actually ready to finish, but don't emit yet
431- var finished = needFinish ( state ) || stream . destroyed ;
431+ const finished = needFinish ( state ) || stream . destroyed ;
432432
433433 if ( ! finished &&
434434 ! state . corked &&
@@ -499,17 +499,17 @@ function errorBuffer(state, err) {
499499// If there's something in the buffer waiting, then process it
500500function clearBuffer ( stream , state ) {
501501 state . bufferProcessing = true ;
502- var entry = state . bufferedRequest ;
502+ let entry = state . bufferedRequest ;
503503
504504 if ( stream . _writev && entry && entry . next ) {
505505 // Fast case, write everything using _writev()
506- var l = state . bufferedRequestCount ;
507- var buffer = new Array ( l ) ;
508- var holder = state . corkedRequestsFree ;
506+ const l = state . bufferedRequestCount ;
507+ const buffer = new Array ( l ) ;
508+ const holder = state . corkedRequestsFree ;
509509 holder . entry = entry ;
510510
511- var count = 0 ;
512- var allBuffers = true ;
511+ let count = 0 ;
512+ let allBuffers = true ;
513513 while ( entry ) {
514514 buffer [ count ] = entry ;
515515 if ( entry . encoding !== 'buffer' )
@@ -529,18 +529,18 @@ function clearBuffer(stream, state) {
529529 state . corkedRequestsFree = holder . next ;
530530 holder . next = null ;
531531 } else {
532- var corkReq = { next : null , entry : null , finish : undefined } ;
532+ const corkReq = { next : null , entry : null , finish : undefined } ;
533533 corkReq . finish = onCorkedFinish . bind ( undefined , corkReq , state ) ;
534534 state . corkedRequestsFree = corkReq ;
535535 }
536536 state . bufferedRequestCount = 0 ;
537537 } else {
538538 // Slow case, write chunks one-by-one
539539 while ( entry ) {
540- var chunk = entry . chunk ;
541- var encoding = entry . encoding ;
542- var cb = entry . callback ;
543- var len = state . objectMode ? 1 : chunk . length ;
540+ const chunk = entry . chunk ;
541+ const encoding = entry . encoding ;
542+ const cb = entry . callback ;
543+ const len = state . objectMode ? 1 : chunk . length ;
544544
545545 doWrite ( stream , state , false , len , chunk , encoding , cb ) ;
546546 entry = entry . next ;
@@ -677,10 +677,10 @@ function endWritable(stream, state, cb) {
677677}
678678
679679function onCorkedFinish ( corkReq , state , err ) {
680- var entry = corkReq . entry ;
680+ let entry = corkReq . entry ;
681681 corkReq . entry = null ;
682682 while ( entry ) {
683- var cb = entry . callback ;
683+ const cb = entry . callback ;
684684 state . pendingcb -- ;
685685 cb ( err ) ;
686686 entry = entry . next ;
0 commit comments