Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
stream: removed parentheses and changed comparison operator to <= in …
…highWaterMark (needMoreData function)
  • Loading branch information
Vishal Bisht committed Apr 11, 2018
commit 1d461cb4372b9fff23a9b304e113b06d2fa82ff1
3 changes: 1 addition & 2 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ function chunkInvalid(state, chunk) {
// needReadable was set, then we ought to push more, so that another
// 'readable' event will be triggered.
function needMoreData(state) {
return !state.ended &&
(state.length < state.highWaterMark);
return !state.ended && state.length <= state.highWaterMark;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: this function could be inlined. It only has a single call site.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs to be <= as above

Copy link
Copy Markdown
Contributor Author

@vishal7201 vishal7201 Apr 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with <= , a test case is failing AssertionError [ERR_ASSERTION]: true strictEqual false at Object.<anonymous> (node/test/parallel/test-stream2-objects.js:212:12)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, this is ok.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove the parenthesis? They are not needed anymore.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can prob also be a one liner as this looks like it's <80 chars

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. I will do that


Readable.prototype.isPaused = function() {
Expand Down