From a7419d09027e2f4cf125e978f98f4e49e8ca353c Mon Sep 17 00:00:00 2001 From: alejandro estrada Date: Thu, 8 Feb 2018 13:01:33 -0500 Subject: [PATCH] src: replace var for let / const. Replace var for let or const. PR-URL: https://github.com/nodejs/node/pull/18649 Reviewed-By: Ruben Bridgewater Reviewed-By: Julian Duque Reviewed-By: James M Snell --- lib/internal/async_hooks.js | 4 ++-- lib/internal/bootstrap_node.js | 8 ++++---- lib/internal/readline.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js index 1e9b89ce5e65ff..ea49239a6178bb 100644 --- a/lib/internal/async_hooks.js +++ b/lib/internal/async_hooks.js @@ -262,7 +262,7 @@ function getOrSetAsyncId(object) { // the user to safeguard this call and make sure it's zero'd out when the // constructor is complete. function getDefaultTriggerAsyncId() { - var defaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId]; + let defaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId]; // If defaultTriggerAsyncId isn't set, use the executionAsyncId if (defaultTriggerAsyncId < 0) defaultTriggerAsyncId = async_id_fields[kExecutionAsyncId]; @@ -276,7 +276,7 @@ function defaultTriggerAsyncIdScope(triggerAsyncId, block, ...args) { const oldDefaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId]; async_id_fields[kDefaultTriggerAsyncId] = triggerAsyncId; - var ret; + let ret; try { ret = Reflect.apply(block, null, args); } finally { diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 6b718df2acba5a..2766a8d28d0874 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -173,7 +173,7 @@ const fs = NativeModule.require('fs'); // read the source const filename = Module._resolveFilename(process.argv[1]); - var source = fs.readFileSync(filename, 'utf-8'); + const source = fs.readFileSync(filename, 'utf-8'); checkScriptSyntax(source, filename); process.exit(0); } @@ -219,7 +219,7 @@ // Read all of stdin - execute it. process.stdin.setEncoding('utf8'); - var code = ''; + let code = ''; process.stdin.on('data', function(d) { code += d; }); @@ -467,7 +467,7 @@ const versionTypes = icu.getVersion().split(','); for (var n = 0; n < versionTypes.length; n++) { - var name = versionTypes[n]; + const name = versionTypes[n]; const version = icu.getVersion(name); Object.defineProperty(process.versions, name, { writable: false, @@ -632,7 +632,7 @@ ]; NativeModule.prototype.compile = function() { - var source = NativeModule.getSource(this.id); + let source = NativeModule.getSource(this.id); source = NativeModule.wrap(source); this.loading = true; diff --git a/lib/internal/readline.js b/lib/internal/readline.js index b15ed4972ef7f2..e3d3007a75c645 100644 --- a/lib/internal/readline.js +++ b/lib/internal/readline.js @@ -9,8 +9,8 @@ const ansi = const kEscape = '\x1b'; -var getStringWidth; -var isFullWidthCodePoint; +let getStringWidth; +let isFullWidthCodePoint; function CSI(strings, ...args) { let ret = `${kEscape}[`;