net: replace brand checks with identity checks · nodejs/node@d07bd79
@@ -381,7 +381,7 @@ function Socket(options) {
381381'is not supported',
382382);
383383}
384-if (typeof options?.keepAliveInitialDelay !== 'undefined') {
384+if (options?.keepAliveInitialDelay !== undefined) {
385385validateNumber(
386386options?.keepAliveInitialDelay, 'options.keepAliveInitialDelay',
387387);
@@ -1319,7 +1319,7 @@ function lookupAndConnect(self, options) {
13191319validateNumber(localPort, 'options.localPort');
13201320}
132113211322-if (typeof port !== 'undefined') {
1322+if (port !== undefined) {
13231323if (typeof port !== 'number' && typeof port !== 'string') {
13241324throw new ERR_INVALID_ARG_TYPE('options.port',
13251325['number', 'string'], port);
@@ -1776,7 +1776,7 @@ function Server(options, connectionListener) {
17761776} else {
17771777throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
17781778}
1779-if (typeof options.keepAliveInitialDelay !== 'undefined') {
1779+if (options.keepAliveInitialDelay !== undefined) {
17801780validateNumber(
17811781options.keepAliveInitialDelay, 'options.keepAliveInitialDelay',
17821782);
@@ -1785,7 +1785,7 @@ function Server(options, connectionListener) {
17851785options.keepAliveInitialDelay = 0;
17861786}
17871787}
1788-if (typeof options.highWaterMark !== 'undefined') {
1788+if (options.highWaterMark !== undefined) {
17891789validateNumber(
17901790options.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
20782078if (args.length === 0 || typeof args[0] === 'function' ||
2079-(typeof options.port === 'undefined' && 'port' in options) ||
2079+(options.port === undefined && 'port' in options) ||
20802080options.port === null) {
20812081options.port = 0;
20822082}