Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4ee3238

Browse filesBrowse 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
Copy full SHA for 4ee3238

File tree

Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-3
lines changed
Open diff view settings
Collapse file

‎lib/async_hooks.js‎

Copy file name to clipboardExpand all lines: lib/async_hooks.js
+2-3Lines changed: 2 additions & 3 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.