From 4a16a4da45d90e2799915484842fce54b162ef70 Mon Sep 17 00:00:00 2001 From: dexterleng Date: Fri, 16 Nov 2018 10:28:06 +0800 Subject: [PATCH] fs: inline typeof check PR-URL: https://github.com/nodejs/node/pull/24390 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Anna Henningsen Reviewed-By: Franziska Hinkelmann Reviewed-By: Colin Ihrig Reviewed-By: Weijia Wang Reviewed-By: James M Snell --- lib/internal/fs/streams.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js index 6f747cc3c8c63f..6c9910703adbaa 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -189,8 +189,7 @@ ReadStream.prototype._read = function(n) { }; ReadStream.prototype._destroy = function(err, cb) { - const isOpen = typeof this.fd !== 'number'; - if (isOpen) { + if (typeof this.fd !== 'number') { this.once('open', closeFsStream.bind(null, this, cb, err)); return; }