Skip to content

Commit f4d5c35

Browse files
cjihrigBethGriggs
authored andcommitted
net: use strict comparisons for fd
This commit removes an eslint-disable comment, and moves file descriptor checks to use strict equality. These checks were using loose equality to support numeric and string file descriptors. However, d9e95d8 introduced strict validation, making the loose equality checks redundant. PR-URL: #25014 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 4f0d17b commit f4d5c35

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/net.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,8 @@ function Socket(options) {
281281
throw errnoException(err, 'open');
282282

283283
this[async_id_symbol] = this._handle.getAsyncId();
284-
// options.fd can be string (since it is user-defined),
285-
// so changing this to === would be semver-major
286-
// See: https://github.com/nodejs/node/pull/11513
287-
// eslint-disable-next-line eqeqeq
288-
if ((fd == 1 || fd == 2) &&
284+
285+
if ((fd === 1 || fd === 2) &&
289286
(this._handle instanceof Pipe) &&
290287
process.platform === 'win32') {
291288
// Make stdout and stderr blocking on Windows

0 commit comments

Comments
 (0)