From a2df87cc8037ed0b31bf76f314dfd93d8a33b4f5 Mon Sep 17 00:00:00 2001 From: Artem Maksimov Date: Wed, 6 Nov 2019 13:57:02 +0300 Subject: [PATCH] lib: change var to let/const in internal/querystring.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/30286 Reviewed-By: Anna Henningsen Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Jiawen Geng Reviewed-By: Anto Aravinth Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat Reviewed-By: Ruben Bridgewater Reviewed-By: Gireesh Punathil Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- lib/internal/querystring.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/internal/querystring.js b/lib/internal/querystring.js index ca978eb69d7860..ecb4e072d83873 100644 --- a/lib/internal/querystring.js +++ b/lib/internal/querystring.js @@ -3,7 +3,7 @@ const { ERR_INVALID_URI } = require('internal/errors').codes; const hexTable = new Array(256); -for (var i = 0; i < 256; ++i) +for (let i = 0; i < 256; ++i) hexTable[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase(); const isHexTable = [ @@ -30,11 +30,11 @@ function encodeStr(str, noEscapeTable, hexTable) { if (len === 0) return ''; - var out = ''; - var lastPos = 0; + let out = ''; + let lastPos = 0; - for (var i = 0; i < len; i++) { - var c = str.charCodeAt(i); + for (let i = 0; i < len; i++) { + let c = str.charCodeAt(i); // ASCII if (c < 0x80) { @@ -73,7 +73,7 @@ function encodeStr(str, noEscapeTable, hexTable) { if (i >= len) throw new ERR_INVALID_URI(); - var c2 = str.charCodeAt(i) & 0x3FF; + const c2 = str.charCodeAt(i) & 0x3FF; lastPos = i + 1; c = 0x10000 + (((c & 0x3FF) << 10) | c2);