Skip to content

Commit 804e7aa

Browse files
committedJan 21, 2015
lib: use const to define constants
This commit replaces a number of var statements throughout the lib code with const statements. PR-URL: nodejs#541 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 803883b commit 804e7aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+403
-416
lines changed
 

‎lib/_debug_agent.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
'use strict';
22

3-
var assert = require('assert');
4-
var net = require('net');
5-
var util = require('util');
6-
var Buffer = require('buffer').Buffer;
7-
8-
var Transform = require('stream').Transform;
3+
const assert = require('assert');
4+
const net = require('net');
5+
const util = require('util');
6+
const Buffer = require('buffer').Buffer;
7+
const Transform = require('stream').Transform;
98

109
exports.start = function start() {
1110
var agent = new Agent();
1211

1312
// Do not let `agent.listen()` request listening from cluster master
14-
var cluster = require('cluster');
13+
const cluster = require('cluster');
1514
cluster.isWorker = false;
1615
cluster.isMaster = true;
1716

‎lib/_debugger.js

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

3-
var util = require('util'),
4-
path = require('path'),
5-
net = require('net'),
6-
vm = require('vm'),
7-
module = require('module'),
8-
repl = module.requireRepl(),
9-
inherits = util.inherits,
10-
assert = require('assert'),
11-
spawn = require('child_process').spawn;
3+
const util = require('util');
4+
const path = require('path');
5+
const net = require('net');
6+
const vm = require('vm');
7+
const module = require('module');
8+
const repl = module.requireRepl();
9+
const inherits = util.inherits;
10+
const assert = require('assert');
11+
const spawn = require('child_process').spawn;
1212

1313
exports.start = function(argv, stdin, stdout) {
1414
argv || (argv = process.argv.slice(2));
@@ -137,7 +137,7 @@ Protocol.prototype.serialize = function(req) {
137137
};
138138

139139

140-
var NO_FRAME = -1;
140+
const NO_FRAME = -1;
141141

142142
function Client() {
143143
net.Stream.call(this);
@@ -176,7 +176,7 @@ Client.prototype._addHandle = function(desc) {
176176
};
177177

178178

179-
var natives = process.binding('natives');
179+
const natives = process.binding('natives');
180180

181181

182182
Client.prototype._addScript = function(desc) {
@@ -645,7 +645,7 @@ Client.prototype.fullTrace = function(cb) {
645645

646646

647647

648-
var commands = [
648+
const commands = [
649649
[
650650
'run (r)',
651651
'cont (c)',
@@ -772,22 +772,22 @@ function Interface(stdin, stdout, args) {
772772
process.once('SIGTERM', process.exit.bind(process, 0));
773773
process.once('SIGHUP', process.exit.bind(process, 0));
774774

775-
var proto = Interface.prototype,
776-
ignored = ['pause', 'resume', 'exitRepl', 'handleBreak',
777-
'requireConnection', 'killChild', 'trySpawn',
778-
'controlEval', 'debugEval', 'print', 'childPrint',
779-
'clearline'],
780-
shortcut = {
781-
'run': 'r',
782-
'cont': 'c',
783-
'next': 'n',
784-
'step': 's',
785-
'out': 'o',
786-
'backtrace': 'bt',
787-
'setBreakpoint': 'sb',
788-
'clearBreakpoint': 'cb',
789-
'pause_': 'pause'
790-
};
775+
var proto = Interface.prototype;
776+
const ignored = ['pause', 'resume', 'exitRepl', 'handleBreak',
777+
'requireConnection', 'killChild', 'trySpawn',
778+
'controlEval', 'debugEval', 'print', 'childPrint',
779+
'clearline'];
780+
const shortcut = {
781+
'run': 'r',
782+
'cont': 'c',
783+
'next': 'n',
784+
'step': 's',
785+
'out': 'o',
786+
'backtrace': 'bt',
787+
'setBreakpoint': 'sb',
788+
'clearBreakpoint': 'cb',
789+
'pause_': 'pause'
790+
};
791791

792792
function defineProperty(key, protoKey) {
793793
// Check arity

0 commit comments

Comments
 (0)
Please sign in to comment.