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

tls: use optional chaining to simplify checks #41337

Merged
merged 1 commit into from Jan 5, 2022

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Dec 27, 2021

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. tls Issues and PRs related to the tls subsystem. labels Dec 27, 2021
@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Dec 27, 2021
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 27, 2021
@nodejs-github-bot
Copy link
Collaborator

@@ -161,11 +161,9 @@ function configSecureContext(context, options = {}, name = 'options') {
for (let i = 0; i < key.length; ++i) {
const val = key[i];
const pem = (
val !== undefined && val !== null &&
val.pem !== undefined ? val.pem : val);
val?.pem !== undefined ? val.pem : val);

Choose a reason for hiding this comment

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

Suggested change
val?.pem !== undefined ? val.pem : val);
val?.pem ?? val);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if val.pem is null?

Copy link
Member

Choose a reason for hiding this comment

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

Using ?? would change the current behavior. If we want to keep this a refactoring, we can't use ??. Now, if we know that val.pem can never be null, we can make that change safely - but maybe in a separate commit?

@nodejs-github-bot
Copy link
Collaborator

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 5, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 5, 2022
@nodejs-github-bot nodejs-github-bot merged commit f34c0e0 into nodejs:master Jan 5, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in f34c0e0

@aduh95 aduh95 deleted the tls-optional-chaining branch January 5, 2022 14:25
targos pushed a commit that referenced this pull request Jan 14, 2022
PR-URL: #41337
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
danielleadams pushed a commit that referenced this pull request Jan 31, 2022
PR-URL: #41337
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Linkgoron pushed a commit to Linkgoron/node that referenced this pull request Jan 31, 2022
PR-URL: nodejs#41337
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
danielleadams pushed a commit that referenced this pull request Feb 1, 2022
PR-URL: #41337
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@danielleadams danielleadams mentioned this pull request Feb 1, 2022
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. needs-ci PRs that need a full CI run. tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants