From acd7758959bf98746f35aa92f39fea259f89e30e Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Sun, 21 Apr 2024 01:24:25 +0900 Subject: [PATCH] lib: use predefined variable instead of bit operation PR-URL: https://github.com/nodejs/node/pull/52580 Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Benjamin Gruenbaum Reviewed-By: Daeyeon Jeong Reviewed-By: Luigi Pinca --- lib/internal/abort_controller.js | 5 ++--- lib/internal/event_target.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/internal/abort_controller.js b/lib/internal/abort_controller.js index ce3539fda3154d..6aa013b5894e89 100644 --- a/lib/internal/abort_controller.js +++ b/lib/internal/abort_controller.js @@ -46,8 +46,7 @@ const { validateAbortSignalArray, validateObject, validateUint32, - kValidateObjectAllowArray, - kValidateObjectAllowFunction, + kValidateObjectAllowObjects, } = require('internal/validators'); const { @@ -434,7 +433,7 @@ async function aborted(signal, resource) { throw new ERR_INVALID_ARG_TYPE('signal', 'AbortSignal', signal); } validateAbortSignal(signal, 'signal'); - validateObject(resource, 'resource', kValidateObjectAllowArray | kValidateObjectAllowFunction); + validateObject(resource, 'resource', kValidateObjectAllowObjects); if (signal.aborted) return PromiseResolve(); const abortPromise = createDeferredPromise(); diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index 9d9ad1f222b903..77cb7a12bbb483 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -40,8 +40,7 @@ const { validateObject, validateString, validateInternalField, - kValidateObjectAllowArray, - kValidateObjectAllowFunction, + kValidateObjectAllowObjects, } = require('internal/validators'); const { @@ -1060,7 +1059,7 @@ function validateEventListenerOptions(options) { if (options === null) return kEmptyObject; - validateObject(options, 'options', kValidateObjectAllowArray | kValidateObjectAllowFunction); + validateObject(options, 'options', kValidateObjectAllowObjects); return { once: Boolean(options.once), capture: Boolean(options.capture),