From 9c18838e8e3b714f4325218dcbb94d8ab5fa8df0 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 4bbb6463e782b2..d653724474f314 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -184,11 +184,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