From 702bfa0b7c9cb2344522990d9654b8c821456fe0 Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Sat, 21 May 2022 17:49:57 +0800 Subject: [PATCH] async_hooks: use `kEmptyObject` PR-URL: https://github.com/nodejs/node/pull/43159 Reviewed-By: Matteo Collina Reviewed-By: Antoine du Hamel --- lib/async_hooks.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/async_hooks.js b/lib/async_hooks.js index fed0f07e647dcf..8638bb4d7b3497 100644 --- a/lib/async_hooks.js +++ b/lib/async_hooks.js @@ -20,6 +20,7 @@ const { ERR_ASYNC_TYPE, ERR_INVALID_ASYNC_ID } = require('internal/errors').codes; +const { kEmptyObject } = require('internal/util'); const { validateFunction, validateString, @@ -156,7 +157,7 @@ function createHook(fns) { const destroyedSymbol = Symbol('destroyed'); class AsyncResource { - constructor(type, opts = {}) { + constructor(type, opts = kEmptyObject) { validateString(type, 'type'); let triggerAsyncId = opts;