From 0b2cff28b940667d66ab9e81c0a5c8a03cfea374 Mon Sep 17 00:00:00 2001 From: Jesus Hernandez Date: Sat, 4 Apr 2020 17:53:29 -0500 Subject: [PATCH] fs: remove unnecessary else statement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/32662 Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Juan José Arboleda --- lib/internal/fs/promises.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index d4a2735db9457a..44991fe76878d5 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -188,11 +188,8 @@ async function readFileHandle(filehandle, options) { } while (!endOfFile); const result = Buffer.concat(chunks); - if (options.encoding) { - return result.toString(options.encoding); - } else { - return result; - } + + return options.encoding ? result.toString(options.encoding) : result; } // All of the functions are defined as async in order to ensure that errors