Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ac8d212

Browse filesBrowse files
TrottFishrock123
authored andcommitted
debugger: refactor _debugger.js
* `==` -> `===` * use white space in array to improve readability PR-URL: #9860 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 346204d commit ac8d212
Copy full SHA for ac8d212

File tree

Expand file treeCollapse file tree

1 file changed

+32
-22
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+32
-22
lines changed
Open diff view settings
Collapse file

‎lib/_debugger.js‎

Copy file name to clipboardExpand all lines: lib/_debugger.js
+32-22Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Client.prototype._addScript = function(desc) {
187187
this.scripts[desc.id] = desc;
188188
if (desc.name) {
189189
desc.isNative = (desc.name.replace('.js', '') in natives) ||
190-
desc.name == 'node.js';
190+
desc.name === 'node.js';
191191
}
192192
};
193193

@@ -202,7 +202,7 @@ Client.prototype._onResponse = function(res) {
202202
var index = -1;
203203

204204
this._reqCallbacks.some(function(fn, i) {
205-
if (fn.request_seq == res.body.request_seq) {
205+
if (fn.request_seq === res.body.request_seq) {
206206
cb = fn;
207207
index = i;
208208
return true;
@@ -212,25 +212,25 @@ Client.prototype._onResponse = function(res) {
212212
var self = this;
213213
var handled = false;
214214

215-
if (res.headers.Type == 'connect') {
215+
if (res.headers.Type === 'connect') {
216216
// Request a list of scripts for our own storage.
217217
self.reqScripts();
218218
self.emit('ready');
219219
handled = true;
220220

221-
} else if (res.body && res.body.event == 'break') {
221+
} else if (res.body && res.body.event === 'break') {
222222
this.emit('break', res.body);
223223
handled = true;
224224

225-
} else if (res.body && res.body.event == 'exception') {
225+
} else if (res.body && res.body.event === 'exception') {
226226
this.emit('exception', res.body);
227227
handled = true;
228228

229-
} else if (res.body && res.body.event == 'afterCompile') {
229+
} else if (res.body && res.body.event === 'afterCompile') {
230230
this._addHandle(res.body.body.script);
231231
handled = true;
232232

233-
} else if (res.body && res.body.event == 'scriptCollected') {
233+
} else if (res.body && res.body.event === 'scriptCollected') {
234234
// ???
235235
this._removeScript(res.body.body.script);
236236
handled = true;
@@ -328,7 +328,7 @@ Client.prototype.reqScopes = function(cb) {
328328
Client.prototype.reqEval = function(expression, cb) {
329329
var self = this;
330330

331-
if (this.currentFrame == NO_FRAME) {
331+
if (this.currentFrame === NO_FRAME) {
332332
// Only need to eval in global scope.
333333
this.reqFrameEval(expression, NO_FRAME, cb);
334334
return;
@@ -358,7 +358,7 @@ Client.prototype.reqEval = function(expression, cb) {
358358

359359
// Finds the first scope in the array in which the expression evals.
360360
Client.prototype._reqFramesEval = function(expression, evalFrames, cb) {
361-
if (evalFrames.length == 0) {
361+
if (evalFrames.length === 0) {
362362
// Just eval in global scope.
363363
this.reqFrameEval(expression, NO_FRAME, cb);
364364
return;
@@ -382,7 +382,7 @@ Client.prototype.reqFrameEval = function(expression, frame, cb) {
382382
arguments: { expression: expression }
383383
};
384384

385-
if (frame == NO_FRAME) {
385+
if (frame === NO_FRAME) {
386386
req.arguments.global = true;
387387
} else {
388388
req.arguments.frame = frame;
@@ -529,9 +529,9 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
529529
var mirror;
530530
var waiting = 1;
531531

532-
if (handle.className == 'Array') {
532+
if (handle.className === 'Array') {
533533
mirror = [];
534-
} else if (handle.className == 'Date') {
534+
} else if (handle.className === 'Date') {
535535
mirror = new Date(handle.value);
536536
} else {
537537
mirror = {};
@@ -774,10 +774,20 @@ function Interface(stdin, stdout, args) {
774774
process.once('SIGHUP', process.exit.bind(process, 0));
775775

776776
var proto = Interface.prototype;
777-
const ignored = ['pause', 'resume', 'exitRepl', 'handleBreak',
778-
'requireConnection', 'killChild', 'trySpawn',
779-
'controlEval', 'debugEval', 'print', 'childPrint',
780-
'clearline'];
777+
const ignored = [
778+
'pause',
779+
'resume',
780+
'exitRepl',
781+
'handleBreak',
782+
'requireConnection',
783+
'killChild',
784+
'trySpawn',
785+
'controlEval',
786+
'debugEval',
787+
'print',
788+
'childPrint',
789+
'clearline'
790+
];
781791
const shortcut = {
782792
'run': 'r',
783793
'cont': 'c',
@@ -1097,14 +1107,14 @@ Interface.prototype.list = function(delta) {
10971107
var lineno = res.fromLine + i + 1;
10981108
if (lineno < from || lineno > to) continue;
10991109

1100-
const current = lineno == 1 + client.currentSourceLine;
1110+
const current = lineno === 1 + client.currentSourceLine;
11011111
const breakpoint = client.breakpoints.some(function(bp) {
11021112
return (bp.scriptReq === client.currentScript ||
11031113
bp.script === client.currentScript) &&
1104-
bp.line == lineno;
1114+
bp.line === lineno;
11051115
});
11061116

1107-
if (lineno == 1) {
1117+
if (lineno === 1) {
11081118
// The first line needs to have the module wrapper filtered out of
11091119
// it.
11101120
var wrapper = Module.wrapper[0];
@@ -1151,7 +1161,7 @@ Interface.prototype.backtrace = function() {
11511161
return;
11521162
}
11531163

1154-
if (bt.totalFrames == 0) {
1164+
if (bt.totalFrames === 0) {
11551165
self.print('(empty stack)');
11561166
} else {
11571167
const trace = [];
@@ -1193,10 +1203,10 @@ Interface.prototype.scripts = function() {
11931203
var script = client.scripts[id];
11941204
if (script !== null && typeof script === 'object' && script.name) {
11951205
if (displayNatives ||
1196-
script.name == client.currentScript ||
1206+
script.name === client.currentScript ||
11971207
!script.isNative) {
11981208
scripts.push(
1199-
(script.name == client.currentScript ? '* ' : ' ') +
1209+
(script.name === client.currentScript ? '* ' : ' ') +
12001210
id + ': ' +
12011211
path.basename(script.name)
12021212
);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.