From 62825805c2a519167fd62ddeee0ed2590df277fa Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Fri, 31 Jan 2020 20:20:32 +0100 Subject: [PATCH] fixup: simplify --- lib/internal/streams/end-of-stream.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/internal/streams/end-of-stream.js b/lib/internal/streams/end-of-stream.js index 8061ce1849525a..d6e1c5804eaf4a 100644 --- a/lib/internal/streams/end-of-stream.js +++ b/lib/internal/streams/end-of-stream.js @@ -28,10 +28,8 @@ function isWritable(stream) { function isWritableFinished(stream) { if (stream.writableFinished) return true; const wState = stream._writableState; - if (wState && wState.finished) return true; - if (wState && wState.ended && wState.length === 0 && - !wState.errored) return true; - return false; + if (!wState || wState.errored) return false; + return wState.finished || (wState.ended && wState.length === 0); } function eos(stream, opts, callback) {