From d3aba3e2caa1f0ab3f46b067a173a2eab21f1baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=88=9A?= Date: Sun, 21 Jan 2018 16:13:14 +0800 Subject: [PATCH] stream: delete unused code In implementation of `stream.Writable`, `writable._write()` is always called with a callback that is `_writableState.onwrite()`. And In `afterTransform()`, `ts.writechunk` and `ts.writecb` are assigned to null. So, `ts.writecb` is a true value if `ts.writechunk` isn't null. --- lib/_stream_transform.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js index b8d4a7704aebdb..a9fcddda2d9c83 100644 --- a/lib/_stream_transform.js +++ b/lib/_stream_transform.js @@ -180,7 +180,7 @@ Transform.prototype._write = function(chunk, encoding, cb) { Transform.prototype._read = function(n) { var ts = this._transformState; - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + if (ts.writechunk !== null && !ts.transforming) { ts.transforming = true; this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else {