Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: replace brand checks with identity checks #57341

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ function Socket(options) {
'is not supported',
);
}
if (typeof options?.keepAliveInitialDelay !== 'undefined') {
if (options?.keepAliveInitialDelay !== undefined) {
validateNumber(
options?.keepAliveInitialDelay, 'options.keepAliveInitialDelay',
);
Expand Down Expand Up @@ -1319,7 +1319,7 @@ function lookupAndConnect(self, options) {
validateNumber(localPort, 'options.localPort');
}

if (typeof port !== 'undefined') {
if (port !== undefined) {
if (typeof port !== 'number' && typeof port !== 'string') {
throw new ERR_INVALID_ARG_TYPE('options.port',
['number', 'string'], port);
Expand Down Expand Up @@ -1776,7 +1776,7 @@ function Server(options, connectionListener) {
} else {
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
}
if (typeof options.keepAliveInitialDelay !== 'undefined') {
if (options.keepAliveInitialDelay !== undefined) {
validateNumber(
options.keepAliveInitialDelay, 'options.keepAliveInitialDelay',
);
Expand All @@ -1785,7 +1785,7 @@ function Server(options, connectionListener) {
options.keepAliveInitialDelay = 0;
}
}
if (typeof options.highWaterMark !== 'undefined') {
if (options.highWaterMark !== undefined) {
validateNumber(
options.highWaterMark, 'options.highWaterMark',
);
Expand Down Expand Up @@ -2076,7 +2076,7 @@ Server.prototype.listen = function(...args) {
// or (options[, cb]) where options.port is explicitly set as undefined or
// null, bind to an arbitrary unused port
if (args.length === 0 || typeof args[0] === 'function' ||
(typeof options.port === 'undefined' && 'port' in options) ||
(options.port === undefined && 'port' in options) ||
options.port === null) {
options.port = 0;
}
Expand Down
Loading