@@ -187,7 +187,7 @@ function WritableState(options, stream, isDuplex) {
}
WritableState . prototype . getBuffer = function getBuffer ( ) {
var current = this . bufferedRequest ;
let current = this . bufferedRequest ;
const out = [ ] ;
while ( current ) {
out . push ( current ) ;
@@ -205,7 +205,7 @@ ObjectDefineProperty(WritableState.prototype, 'buffer', {
// Test _writableState for inheritance to account for Duplex streams,
// whose prototype chain only points to Readable.
var realHasInstance ;
let realHasInstance ;
if ( typeof Symbol === 'function' && SymbolHasInstance ) {
realHasInstance = FunctionPrototype [ SymbolHasInstance ] ;
ObjectDefineProperty ( Writable , SymbolHasInstance , {
@@ -357,7 +357,7 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) {
state . needDrain = true ;
if ( state . writing || state . corked || state . errored ) {
var last = state . lastBufferedRequest ;
const last = state . lastBufferedRequest ;
state . lastBufferedRequest = {
chunk,
encoding,
@@ -428,7 +428,7 @@ function onwrite(stream, er) {
}
} else {
// Check if we're actually ready to finish, but don't emit yet
var finished = needFinish ( state ) || stream . destroyed ;
const finished = needFinish ( state ) || stream . destroyed ;
if ( ! finished &&
! state . corked &&
@@ -499,17 +499,17 @@ function errorBuffer(state, err) {
// If there's something in the buffer waiting, then process it
function clearBuffer ( stream , state ) {
state . bufferProcessing = true ;
var entry = state . bufferedRequest ;
let entry = state . bufferedRequest ;
if ( stream . _writev && entry && entry . next ) {
// Fast case, write everything using _writev()
var l = state . bufferedRequestCount ;
var buffer = new Array ( l ) ;
var holder = state . corkedRequestsFree ;
const l = state . bufferedRequestCount ;
const buffer = new Array ( l ) ;
const holder = state . corkedRequestsFree ;
holder . entry = entry ;
var count = 0 ;
var allBuffers = true ;
let count = 0 ;
let allBuffers = true ;
while ( entry ) {
buffer [ count ] = entry ;
if ( entry . encoding !== 'buffer' )
@@ -529,18 +529,18 @@ function clearBuffer(stream, state) {
state . corkedRequestsFree = holder . next ;
holder . next = null ;
} else {
var corkReq = { next : null , entry : null , finish : undefined } ;
const corkReq = { next : null , entry : null , finish : undefined } ;
corkReq . finish = onCorkedFinish . bind ( undefined , corkReq , state ) ;
state . corkedRequestsFree = corkReq ;
}
state . bufferedRequestCount = 0 ;
} else {
// Slow case, write chunks one-by-one
while ( entry ) {
var chunk = entry . chunk ;
var encoding = entry . encoding ;
var cb = entry . callback ;
var len = state . objectMode ? 1 : chunk . length ;
const chunk = entry . chunk ;
const encoding = entry . encoding ;
const cb = entry . callback ;
const len = state . objectMode ? 1 : chunk . length ;
doWrite ( stream , state , false , len , chunk , encoding , cb ) ;
entry = entry . next ;
@@ -677,10 +677,10 @@ function endWritable(stream, state, cb) {
}
function onCorkedFinish ( corkReq , state , err ) {
var entry = corkReq . entry ;
let entry = corkReq . entry ;
corkReq . entry = null ;
while ( entry ) {
var cb = entry . callback ;
const cb = entry . callback ;
state . pendingcb -- ;
cb ( err ) ;
entry = entry . next ;