From 45fac728466d13d4c1afd43f8e0754ccd47c453e Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Fri, 7 Feb 2020 17:00:00 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20use=C2=A0a=C2=A0global=C2=A0symbol=20fo?= =?UTF-8?q?r=C2=A0`util.promisify.custom`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define `util.promisify.custom` as `Symbol.for(nodejs.util.inspect.custom)`, rather than as `Symbol(util.inspect.custom)`. This allows custom `promisify` wrappers to easily/safely be defined in non‑Node.js environments. Refs: https://github.com/nodejs/node/issues/31647 Refs: https://github.com/nodejs/node/pull/31672 --- implementation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/implementation.js b/implementation.js index 3cd88f1..bc3b139 100644 --- a/implementation.js +++ b/implementation.js @@ -23,7 +23,8 @@ var $forEach = callBound('Array.prototype.forEach'); var hasSymbols = require('has-symbols')(); -var kCustomPromisifiedSymbol = hasSymbols ? Symbol('util.promisify.custom') : null; +// eslint-disable-next-line no-restricted-properties +var kCustomPromisifiedSymbol = hasSymbols ? Symbol['for']('nodejs.util.promisify.custom') : null; var kCustomPromisifyArgsSymbol = hasSymbols ? Symbol('customPromisifyArgs') : null; module.exports = function promisify(orig) {