Skip to content

Commit

Permalink
stream: check for null instead of falsy in loops
Browse files Browse the repository at this point in the history
Check for null in while loops. This is preparing the code for
the no-cond-assign ESLint rule.

PR-URL: #41614
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
Trott authored and BethGriggs committed Jan 24, 2022
1 parent 627f19a commit 16dec42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/streams/buffer_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = class BufferList {
return '';
let p = this.head;
let ret = '' + p.data;
while (p = p.next)
while ((p = p.next) !== null)
ret += s + p.data;
return ret;
}
Expand Down Expand Up @@ -129,7 +129,7 @@ module.exports = class BufferList {
break;
}
++c;
} while (p = p.next);
} while ((p = p.next) !== null);
this.length -= c;
return ret;
}
Expand Down Expand Up @@ -163,7 +163,7 @@ module.exports = class BufferList {
break;
}
++c;
} while (p = p.next);
} while ((p = p.next) !== null);
this.length -= c;
return ret;
}
Expand Down

0 comments on commit 16dec42

Please sign in to comment.