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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Reviewed-By: Zijian Liu <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
  • Loading branch information
watilde authored and nodejs-github-bot committed Oct 13, 2021
1 parent e0faf8c commit f570109
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/net.js
Original file line number Diff line number Diff line change
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 f570109

Please sign in to comment.