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: use object destructuring #20959

Closed
wants to merge 1 commit into from

Conversation

starkwang
Copy link
Contributor

@starkwang starkwang commented May 25, 2018

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the net Issues and PRs related to the net subsystem. label May 25, 2018
@starkwang
Copy link
Contributor Author

lib/net.js Outdated
var port = options.port;
var localAddress = options.localAddress;
var localPort = options.localPort;
var { host = 'localhost', port, localAddress, localPort } = options;
Copy link
Member

@BridgeAR BridgeAR May 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not exactly the same as before. I think it is fine but host = 'localhost' !== options.host || 'localhost'. The first part is only going to set it to localhost in case host is undefined while the latter is going to do that for any falsy value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not strict equal but doesn't break CI. Should I revert it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer it if we reverted this change, or at least the part with localhost, other changes LGTM

@@ -244,7 +243,7 @@ function Socket(options) {

options.readable = options.readable || false;
options.writable = options.writable || false;
const allowHalfOpen = options.allowHalfOpen;
const { allowHalfOpen } = options;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there consensus that changes like this are desirable? It's not obvious to me that destructuring is better (or worse) than the existing straightforward assignment in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm... It's just personal preference. I'm free to revert it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trott I just guessed that you do not block this and it is author-ready. If that is not the case, please remove the label again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BridgeAR Correct, not blocking. Thanks for checking.

@starkwang starkwang force-pushed the net-use-destructuring branch from 61c8535 to c43fca8 Compare May 27, 2018 03:07
@BridgeAR
Copy link
Member

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 28, 2018
@apapirovski
Copy link
Member

Landed in a69a29d

@apapirovski apapirovski closed this Jun 1, 2018
apapirovski pushed a commit that referenced this pull request Jun 1, 2018
PR-URL: #20959
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax pushed a commit that referenced this pull request Jun 1, 2018
PR-URL: #20959
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. net Issues and PRs related to the net subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants