From e7899ba1f724aef3572cb225395477c61c866e79 Mon Sep 17 00:00:00 2001 From: Mohammed Keyvanzadeh Date: Sun, 3 Apr 2022 20:06:55 +0430 Subject: [PATCH] os: avoid unnecessary usage of var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `var` keyword is known to be problematic and is not needed here, so better to use the `let` keyword for variable declarations. PR-URL: https://github.com/nodejs/node/pull/42563 Reviewed-By: Tobias Nießen Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Akhil Marsonya Reviewed-By: Luigi Pinca Reviewed-By: Darshan Sen Reviewed-By: Rich Trott Reviewed-By: James M Snell --- lib/os.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/os.js b/lib/os.js index f0f0fdb15f61c0..c1c4bfa694a06b 100644 --- a/lib/os.js +++ b/lib/os.js @@ -171,7 +171,7 @@ platform[SymbolToPrimitive] = () => process.platform; * @returns {string} */ function tmpdir() { - var path; + let path; if (isWindows) { path = process.env.TEMP || process.env.TMP || @@ -223,7 +223,7 @@ function getCIDR(address, netmask, family) { } const parts = StringPrototypeSplit(netmask, split); - for (var i = 0; i < parts.length; i++) { + for (let i = 0; i < parts.length; i++) { if (parts[i] !== '') { const binary = NumberParseInt(parts[i], range); const tmp = countBinaryOnes(binary); @@ -261,7 +261,7 @@ function networkInterfaces() { if (data === undefined) return result; - for (var i = 0; i < data.length; i += 7) { + for (let i = 0; i < data.length; i += 7) { const name = data[i]; const entry = { address: data[i + 1],