Skip to content

Commit b3f9640

Browse files
anonrigaduh95
authored andcommitted
net: replace brand checks with identity checks
PR-URL: #57341 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 6842e3a commit b3f9640

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/net.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ function Socket(options) {
381381
'is not supported',
382382
);
383383
}
384-
if (typeof options?.keepAliveInitialDelay !== 'undefined') {
384+
if (options?.keepAliveInitialDelay !== undefined) {
385385
validateNumber(
386386
options?.keepAliveInitialDelay, 'options.keepAliveInitialDelay',
387387
);
@@ -1319,7 +1319,7 @@ function lookupAndConnect(self, options) {
13191319
validateNumber(localPort, 'options.localPort');
13201320
}
13211321

1322-
if (typeof port !== 'undefined') {
1322+
if (port !== undefined) {
13231323
if (typeof port !== 'number' && typeof port !== 'string') {
13241324
throw new ERR_INVALID_ARG_TYPE('options.port',
13251325
['number', 'string'], port);
@@ -1776,7 +1776,7 @@ function Server(options, connectionListener) {
17761776
} else {
17771777
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
17781778
}
1779-
if (typeof options.keepAliveInitialDelay !== 'undefined') {
1779+
if (options.keepAliveInitialDelay !== undefined) {
17801780
validateNumber(
17811781
options.keepAliveInitialDelay, 'options.keepAliveInitialDelay',
17821782
);
@@ -1785,7 +1785,7 @@ function Server(options, connectionListener) {
17851785
options.keepAliveInitialDelay = 0;
17861786
}
17871787
}
1788-
if (typeof options.highWaterMark !== 'undefined') {
1788+
if (options.highWaterMark !== undefined) {
17891789
validateNumber(
17901790
options.highWaterMark, 'options.highWaterMark',
17911791
);
@@ -2076,7 +2076,7 @@ Server.prototype.listen = function(...args) {
20762076
// or (options[, cb]) where options.port is explicitly set as undefined or
20772077
// null, bind to an arbitrary unused port
20782078
if (args.length === 0 || typeof args[0] === 'function' ||
2079-
(typeof options.port === 'undefined' && 'port' in options) ||
2079+
(options.port === undefined && 'port' in options) ||
20802080
options.port === null) {
20812081
options.port = 0;
20822082
}

0 commit comments

Comments
 (0)