From 1399338938d73fb9082c246e470f5e89d8d68475 Mon Sep 17 00:00:00 2001 From: MaleDong Date: Sun, 10 Feb 2019 21:06:54 +0800 Subject: [PATCH] lib: simplify 'umask' Just check: if 'mask' is not undefined, just call 'validateMode' and then return the unmask value, we don't need split them into two returns. --- lib/internal/process/main_thread_only.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/internal/process/main_thread_only.js b/lib/internal/process/main_thread_only.js index 96c57fda35c755..2572402f620c27 100644 --- a/lib/internal/process/main_thread_only.js +++ b/lib/internal/process/main_thread_only.js @@ -26,11 +26,9 @@ function wrapProcessMethods(binding) { } function umask(mask) { - if (mask === undefined) { - // Get the mask - return binding.umask(mask); + if (mask !== undefined) { + mask = validateMode(mask, 'mask'); } - mask = validateMode(mask, 'mask'); return binding.umask(mask); }