Skip to content

Commit 4fc13b0

Browse files
Saajanaddaleax
authored andcommitted
stream: change var to let/const in stream files
PR-URL: #32214 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 2bf0228 commit 4fc13b0

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/_stream_readable.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ Readable.prototype.read = function(n) {
443443
// 3. Actually pull the requested chunks out of the buffer and return.
444444

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

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

477-
var ret;
477+
let ret;
478478
if (n > 0)
479479
ret = fromList(n, state);
480480
else
@@ -513,7 +513,7 @@ function onEofChunk(stream, state) {
513513
debug('onEofChunk');
514514
if (state.ended) return;
515515
if (state.decoder) {
516-
var chunk = state.decoder.end();
516+
const chunk = state.decoder.end();
517517
if (chunk && chunk.length) {
518518
state.buffer.push(chunk);
519519
state.length += state.objectMode ? 1 : chunk.length;
@@ -674,7 +674,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
674674

675675
let ondrain;
676676

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

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

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

990990
stream.on('end', () => {
991991
debug('wrapped end');
992992
if (state.decoder && !state.ended) {
993-
var chunk = state.decoder.end();
993+
const chunk = state.decoder.end();
994994
if (chunk && chunk.length)
995995
this.push(chunk);
996996
}
@@ -1179,7 +1179,7 @@ function fromList(n, state) {
11791179
if (state.length === 0)
11801180
return null;
11811181

1182-
var ret;
1182+
let ret;
11831183
if (state.objectMode)
11841184
ret = state.buffer.shift();
11851185
else if (!n || n >= state.length) {

lib/_stream_transform.js

Lines changed: 1 addition & 1 deletion
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)