From f1569f314dd5fc7cead7f75d09a1d2d0927ef18b Mon Sep 17 00:00:00 2001 From: Daniel Schuech Date: Tue, 12 Nov 2019 16:19:33 +0100 Subject: [PATCH] http2: core.js replace var with let const has to be used in for in loop PR-URL: https://github.com/nodejs/node/pull/30403 Reviewed-By: James M Snell Reviewed-By: David Carlier Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- lib/internal/http2/core.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 9dfb62d27d9e50..c03bd23e7de5c0 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -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); } @@ -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; @@ -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]; }