Skip to content

Commit

Permalink
net: check if option is undefined
Browse files Browse the repository at this point in the history
PR-URL: #40344
Fixes: #40336
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
  • Loading branch information
watilde authored and targos committed Oct 13, 2021
1 parent 1e15137 commit bc86084
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/net.js
Expand Up @@ -282,13 +282,13 @@ const kSetNoDelay = Symbol('kSetNoDelay');

function Socket(options) {
if (!(this instanceof Socket)) return new Socket(options);
if (options.objectMode) {
if (options?.objectMode) {
throw new ERR_INVALID_ARG_VALUE(
'options.objectMode',
options.objectMode,
'is not supported'
);
} else if (options.readableObjectMode || options.writableObjectMode) {
} else if (options?.readableObjectMode || options?.writableObjectMode) {
throw new ERR_INVALID_ARG_VALUE(
`options.${
options.readableObjectMode ? 'readableObjectMode' : 'writableObjectMode'
Expand Down

0 comments on commit bc86084

Please sign in to comment.