Skip to content

Commit cad768e

Browse files
Saajanaddaleax
authored andcommitted
stream: change var to let/const in stream files
PR-URL: #32214 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent ff3615d commit cad768e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/_stream_readable.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ Readable.prototype.read = function(n) {
444444
// 3. Actually pull the requested chunks out of the buffer and return.
445445

446446
// if we need a readable event, then we need to do some reading.
447-
var doRead = state.needReadable;
447+
let doRead = state.needReadable;
448448
debug('need readable', doRead);
449449

450450
// If we currently have less than the highWaterMark, then also read some
@@ -475,7 +475,7 @@ Readable.prototype.read = function(n) {
475475
n = howMuchToRead(nOrig, state);
476476
}
477477

478-
var ret;
478+
let ret;
479479
if (n > 0)
480480
ret = fromList(n, state);
481481
else
@@ -514,7 +514,7 @@ function onEofChunk(stream, state) {
514514
debug('onEofChunk');
515515
if (state.ended) return;
516516
if (state.decoder) {
517-
var chunk = state.decoder.end();
517+
const chunk = state.decoder.end();
518518
if (chunk && chunk.length) {
519519
state.buffer.push(chunk);
520520
state.length += state.objectMode ? 1 : chunk.length;
@@ -675,7 +675,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
675675

676676
let ondrain;
677677

678-
var cleanedUp = false;
678+
let cleanedUp = false;
679679
function cleanup() {
680680
debug('cleanup');
681681
// Cleanup event handlers once the pipe is broken
@@ -816,7 +816,7 @@ Readable.prototype.unpipe = function(dest) {
816816

817817
if (!dest) {
818818
// remove all.
819-
var dests = state.pipes;
819+
const dests = state.pipes;
820820
state.pipes = [];
821821
this.pause();
822822

@@ -984,12 +984,12 @@ function flow(stream) {
984984
// It is an ugly unfortunate mess of history.
985985
Readable.prototype.wrap = function(stream) {
986986
const state = this._readableState;
987-
var paused = false;
987+
let paused = false;
988988

989989
stream.on('end', () => {
990990
debug('wrapped end');
991991
if (state.decoder && !state.ended) {
992-
var chunk = state.decoder.end();
992+
const chunk = state.decoder.end();
993993
if (chunk && chunk.length)
994994
this.push(chunk);
995995
}
@@ -1161,7 +1161,7 @@ function fromList(n, state) {
11611161
if (state.length === 0)
11621162
return null;
11631163

1164-
var ret;
1164+
let ret;
11651165
if (state.objectMode)
11661166
ret = state.buffer.shift();
11671167
else if (!n || n >= state.length) {

lib/_stream_transform.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Transform.prototype._write = function(chunk, encoding, cb) {
172172
ts.writechunk = chunk;
173173
ts.writeencoding = encoding;
174174
if (!ts.transforming) {
175-
var rs = this._readableState;
175+
const rs = this._readableState;
176176
if (ts.needTransform ||
177177
rs.needReadable ||
178178
rs.length < rs.highWaterMark)

0 commit comments

Comments
 (0)