Skip to content

Commit 41a66bc

Browse files
AdriVanHoudtjasnell
authored andcommitted
lib: changed var to const in bootstrap_node.js
PR-URL: #8588 Reviewed-By: Yosuke Furukawa <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Teddy Katz <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent 3ffa6a8 commit 41a66bc

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

lib/internal/bootstrap_node.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
(function(process) {
1111

1212
function startup() {
13-
var EventEmitter = NativeModule.require('events');
13+
const EventEmitter = NativeModule.require('events');
1414
process._eventsCount = 0;
1515

1616
Object.setPrototypeOf(process, Object.create(EventEmitter.prototype, {
@@ -92,7 +92,7 @@
9292
// channel. This needs to be done before any user code gets executed
9393
// (including preload modules).
9494
if (process.argv[1] && process.env.NODE_UNIQUE_ID) {
95-
var cluster = NativeModule.require('cluster');
95+
const cluster = NativeModule.require('cluster');
9696
cluster._setupWorker();
9797

9898
// Make sure it's not accidentally inherited by child processes.
@@ -111,18 +111,18 @@
111111
});
112112
} else if (process.argv[1]) {
113113
// make process.argv[1] into a full path
114-
var path = NativeModule.require('path');
114+
const path = NativeModule.require('path');
115115
process.argv[1] = path.resolve(process.argv[1]);
116116

117-
var Module = NativeModule.require('module');
117+
const Module = NativeModule.require('module');
118118

119119
// check if user passed `-c` or `--check` arguments to Node.
120120
if (process._syntax_check_only != null) {
121-
var vm = NativeModule.require('vm');
122-
var fs = NativeModule.require('fs');
123-
var internalModule = NativeModule.require('internal/module');
121+
const vm = NativeModule.require('vm');
122+
const fs = NativeModule.require('fs');
123+
const internalModule = NativeModule.require('internal/module');
124124
// read the source
125-
var filename = Module._resolveFilename(process.argv[1]);
125+
const filename = Module._resolveFilename(process.argv[1]);
126126
var source = fs.readFileSync(filename, 'utf-8');
127127
// remove shebang and BOM
128128
source = internalModule.stripBOM(source.replace(/^\#\!.*/, ''));
@@ -140,7 +140,7 @@
140140
// If -i or --interactive were passed, or stdin is a TTY.
141141
if (process._forceRepl || NativeModule.require('tty').isatty(0)) {
142142
// REPL
143-
var cliRepl = NativeModule.require('internal/repl');
143+
const cliRepl = NativeModule.require('internal/repl');
144144
cliRepl.createInternalRepl(process.env, function(err, repl) {
145145
if (err) {
146146
throw err;
@@ -254,7 +254,7 @@
254254
wrapConsoleCall) {
255255
if (!inspectorConsole)
256256
return;
257-
var config = {};
257+
const config = {};
258258
for (const key of Object.keys(console)) {
259259
if (!inspectorConsole.hasOwnProperty(key))
260260
continue;
@@ -374,7 +374,7 @@
374374
// V8 debug object about a connection, and runMain when
375375
// that occurs. --isaacs
376376

377-
var debugTimeout = +process.env.NODE_DEBUG_TIMEOUT || 50;
377+
const debugTimeout = +process.env.NODE_DEBUG_TIMEOUT || 50;
378378
setTimeout(entryFunction, debugTimeout);
379379

380380
} else {
@@ -387,9 +387,9 @@
387387
// core modules found in lib/*.js. All core modules are compiled into the
388388
// node binary, so they can be loaded faster.
389389

390-
var ContextifyScript = process.binding('contextify').ContextifyScript;
390+
const ContextifyScript = process.binding('contextify').ContextifyScript;
391391
function runInThisContext(code, options) {
392-
var script = new ContextifyScript(code, options);
392+
const script = new ContextifyScript(code, options);
393393
return script.runInThisContext();
394394
}
395395

@@ -409,7 +409,7 @@
409409
return NativeModule;
410410
}
411411

412-
var cached = NativeModule.getCached(id);
412+
const cached = NativeModule.getCached(id);
413413
if (cached && (cached.loaded || cached.loading)) {
414414
return cached.exports;
415415
}
@@ -420,7 +420,7 @@
420420

421421
process.moduleLoadList.push(`NativeModule ${id}`);
422422

423-
var nativeModule = new NativeModule(id);
423+
const nativeModule = new NativeModule(id);
424424

425425
nativeModule.cache();
426426
nativeModule.compile();
@@ -477,7 +477,7 @@
477477
this.loading = true;
478478

479479
try {
480-
var fn = runInThisContext(source, {
480+
const fn = runInThisContext(source, {
481481
filename: this.filename,
482482
lineOffset: 0,
483483
displayErrors: true

0 commit comments

Comments
 (0)