Skip to content

Commit 4ee3238

Browse files
deokjinkimjuanarbol
authored andcommitted
async_hooks: refactor to use validateObject
PR-URL: #46004 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent fa5b65e commit 4ee3238

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/async_hooks.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const {
2424
const { kEmptyObject } = require('internal/util');
2525
const {
2626
validateFunction,
27+
validateObject,
2728
validateString,
2829
} = require('internal/validators');
2930
const internal_async_hooks = require('internal/async_hooks');
@@ -276,9 +277,7 @@ const storageHook = createHook({
276277

277278
class AsyncLocalStorage {
278279
constructor(options = kEmptyObject) {
279-
if (typeof options !== 'object' || options === null) {
280-
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
281-
}
280+
validateObject(options, 'options');
282281

283282
const { onPropagate = null } = options;
284283
if (onPropagate !== null && typeof onPropagate !== 'function') {

0 commit comments

Comments
 (0)