Skip to content

Commit

Permalink
stream: change var to let/const in stream files
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Saajan authored and addaleax committed Mar 30, 2020
1 parent ff3615d commit cad768e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ Readable.prototype.read = function(n) {
// 3. Actually pull the requested chunks out of the buffer and return.

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

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

var ret;
let ret;
if (n > 0)
ret = fromList(n, state);
else
Expand Down Expand Up @@ -514,7 +514,7 @@ function onEofChunk(stream, state) {
debug('onEofChunk');
if (state.ended) return;
if (state.decoder) {
var chunk = state.decoder.end();
const chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);
state.length += state.objectMode ? 1 : chunk.length;
Expand Down Expand Up @@ -675,7 +675,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {

let ondrain;

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

if (!dest) {
// remove all.
var dests = state.pipes;
const dests = state.pipes;
state.pipes = [];
this.pause();

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

stream.on('end', () => {
debug('wrapped end');
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
const chunk = state.decoder.end();
if (chunk && chunk.length)
this.push(chunk);
}
Expand Down Expand Up @@ -1161,7 +1161,7 @@ function fromList(n, state) {
if (state.length === 0)
return null;

var ret;
let ret;
if (state.objectMode)
ret = state.buffer.shift();
else if (!n || n >= state.length) {
Expand Down
2 changes: 1 addition & 1 deletion lib/_stream_transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Transform.prototype._write = function(chunk, encoding, cb) {
ts.writechunk = chunk;
ts.writeencoding = encoding;
if (!ts.transforming) {
var rs = this._readableState;
const rs = this._readableState;
if (ts.needTransform ||
rs.needReadable ||
rs.length < rs.highWaterMark)
Expand Down

0 comments on commit cad768e

Please sign in to comment.