From 269541901103bbd081e3d6212c1af0b3c7e39839 Mon Sep 17 00:00:00 2001 From: Kazushi Kitaya Date: Fri, 21 Dec 2018 18:32:02 +0900 Subject: [PATCH] util: simplify code Simplify code by using return value of Object.defineProperty directly. --- lib/internal/util.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/util.js b/lib/internal/util.js index 7af06351c91406..652e75504060aa 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -267,10 +267,9 @@ function promisify(original) { if (typeof fn !== 'function') { throw new ERR_INVALID_ARG_TYPE('util.promisify.custom', 'Function', fn); } - Object.defineProperty(fn, kCustomPromisifiedSymbol, { + return Object.defineProperty(fn, kCustomPromisifiedSymbol, { value: fn, enumerable: false, writable: false, configurable: true }); - return fn; } // Names to create an object from in case the callback receives multiple