From 94daea446e99c3a5d49be72de5d2a0152ca71697 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 8c9ed35f81c2f4..ea274eaf2fed50 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -204,8 +204,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; }