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: replace var with let and const #30299

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions lib/_tls_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ exports.SecureContext = SecureContext;
exports.createSecureContext = function createSecureContext(options) {
if (!options) options = {};

var secureOptions = options.secureOptions;
let secureOptions = options.secureOptions;
if (options.honorCipherOrder)
secureOptions |= SSL_OP_CIPHER_SERVER_PREFERENCE;

const c = new SecureContext(options.secureProtocol, secureOptions,
options.minVersion, options.maxVersion);
var i;
var val;
let i;
Copy link
Member

Choose a reason for hiding this comment

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

The variable i can be moved inside for loop on lines 107 and 123

for (let i = 0; i < ca.length; ++i) {
for (let i = 0; i < cert.length; ++i) {

let val;
Copy link
Member

Choose a reason for hiding this comment

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

The variable val can be made const on lines 108 and 124

const val = ca[i];
const val = cert[i];


// Add CA before the cert to be able to load cert's issuer in C++ code.
const { ca } = options;
Expand Down Expand Up @@ -313,7 +313,7 @@ exports.translatePeerCertificate = function translatePeerCertificate(c) {
}
if (c.subject != null) c.subject = parseCertString(c.subject);
if (c.infoAccess != null) {
var info = c.infoAccess;
const info = c.infoAccess;
c.infoAccess = Object.create(null);

// XXX: More key validation?
Expand Down