From a6a15fefb6aea781d3e08f44633cd137ca2c844f 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 c93d89461ffa8a..960ea5492d5f8c 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