Skip to content

Commit

Permalink
async_hooks: refactor to use validateObject
Browse files Browse the repository at this point in the history
PR-URL: #46004
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
deokjinkim authored and RafaelGSS committed Jan 5, 2023
1 parent 28f9089 commit 54b748a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const {
const { kEmptyObject } = require('internal/util');
const {
validateFunction,
validateObject,
validateString,
} = require('internal/validators');
const internal_async_hooks = require('internal/async_hooks');
Expand Down Expand Up @@ -276,9 +277,7 @@ const storageHook = createHook({

class AsyncLocalStorage {
constructor(options = kEmptyObject) {
if (typeof options !== 'object' || options === null) {
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
}
validateObject(options, 'options');

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

0 comments on commit 54b748a

Please sign in to comment.