mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
async_hooks: refactor to use validateObject
PR-URL: https://github.com/nodejs/node/pull/46004 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
@@ -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');
|
||||
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user