Skip to content

Commit

Permalink
http2: core.js replace var with let
Browse files Browse the repository at this point in the history
const has to be used in for in loop

PR-URL: #30403
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
DanielSchuech authored and targos committed Dec 1, 2019
1 parent 0000859 commit f1569f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ function onOrigin(origins) {
if (!session.encrypted || session.destroyed)
return undefined;
const originSet = initOriginSet(session);
for (var n = 0; n < origins.length; n++)
for (let n = 0; n < origins.length; n++)
originSet.add(origins[n]);
session.emit('origin', origins);
}
Expand Down Expand Up @@ -1518,7 +1518,7 @@ class ServerHttp2Session extends Http2Session {
let arr = '';
let len = 0;
const count = origins.length;
for (var i = 0; i < count; i++) {
for (let i = 0; i < count; i++) {
let origin = origins[i];
if (typeof origin === 'string') {
origin = (new URL(origin)).origin;
Expand Down Expand Up @@ -2150,7 +2150,7 @@ function processHeaders(oldHeaders) {
if (oldHeaders !== null && oldHeaders !== undefined) {
const hop = hasOwnProperty.bind(oldHeaders);
// This loop is here for performance reason. Do not change.
for (var key in oldHeaders) {
for (const key in oldHeaders) {
if (hop(key)) {
headers[key] = oldHeaders[key];
}
Expand Down

0 comments on commit f1569f3

Please sign in to comment.