Skip to content

Commit

Permalink
os: avoid unnecessary usage of var
Browse files Browse the repository at this point in the history
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: nodejs#42563
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
VoltrexKeyva authored and xtx1130 committed Apr 25, 2022
1 parent ef2d4d4 commit 966f02c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit 966f02c

Please sign in to comment.