From 88e73862ca432759345a93e92ee1ee633cdd6a6c Mon Sep 17 00:00:00 2001 From: Kazushi Kitaya Date: Fri, 21 Dec 2018 18:32:02 +0900 Subject: [PATCH] util: simplify code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify code by using return value of Object.defineProperty directly. PR-URL: https://github.com/nodejs/node/pull/25162 Reviewed-By: Vladimir de Turckheim Reviewed-By: Masashi Hirano Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Ruben Bridgewater --- 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 3aa00fed35957f..c393e44d5d6258 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