Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 39a4112

Browse filesBrowse files
cjihrigMylesBorins
authored andcommitted
stream: simplify writable's validChunk()
This commit simplifies validChunk() by removing an unnecessary intermediate variable. PR-URL: #20696 Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Jackson Tian <shyvo1987@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 981a2f7 commit 39a4112
Copy full SHA for 39a4112

File tree

Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Collapse file

‎lib/_stream_writable.js‎

Copy file name to clipboardExpand all lines: lib/_stream_writable.js
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ function writeAfterEnd(stream, cb) {
250250
// mode the stream is in. Currently this means that `null` is never accepted
251251
// and undefined/non-string values are only allowed in object mode.
252252
function validChunk(stream, state, chunk, cb) {
253-
var valid = true;
254253
var er;
255254

256255
if (chunk === null) {
@@ -261,9 +260,9 @@ function validChunk(stream, state, chunk, cb) {
261260
if (er) {
262261
stream.emit('error', er);
263262
process.nextTick(cb, er);
264-
valid = false;
263+
return false;
265264
}
266-
return valid;
265+
return true;
267266
}
268267

269268
Writable.prototype.write = function(chunk, encoding, cb) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.