@@ -25,8 +25,8 @@ exports.start = function(argv, stdin, stdout) {
2525 stdin = stdin || process . stdin ;
2626 stdout = stdout || process . stdout ;
2727
28- var args = [ '--debug-brk' ] . concat ( argv ) ,
29- interface_ = new Interface ( stdin , stdout , args ) ;
28+ const args = [ '--debug-brk' ] . concat ( argv ) ;
29+ const interface_ = new Interface ( stdin , stdout , args ) ;
3030
3131 stdin . resume ( ) ;
3232
@@ -197,8 +197,8 @@ Client.prototype._removeScript = function(desc) {
197197
198198
199199Client . prototype . _onResponse = function ( res ) {
200- var cb ,
201- index = - 1 ;
200+ var cb ;
201+ var index = - 1 ;
202202
203203 this . _reqCallbacks . some ( function ( fn , i ) {
204204 if ( fn . request_seq == res . body . request_seq ) {
@@ -295,11 +295,11 @@ Client.prototype.reqLookup = function(refs, cb) {
295295} ;
296296
297297Client . prototype . reqScopes = function ( cb ) {
298- var self = this ,
299- req = {
300- command : 'scopes' ,
301- arguments : { }
302- } ;
298+ const self = this ;
299+ const req = {
300+ command : 'scopes' ,
301+ arguments : { }
302+ } ;
303303
304304 cb = cb || function ( ) { } ;
305305 this . req ( req , function ( err , res ) {
@@ -525,8 +525,8 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
525525 return ;
526526 }
527527
528- var mirror ,
529- waiting = 1 ;
528+ var mirror ;
529+ var waiting = 1 ;
530530
531531 if ( handle . className == 'Array' ) {
532532 mirror = [ ] ;
@@ -676,8 +676,8 @@ var helpMessage = 'Commands: ' + commands.map(function(group) {
676676function SourceUnderline ( sourceText , position , repl ) {
677677 if ( ! sourceText ) return '' ;
678678
679- var head = sourceText . slice ( 0 , position ) ,
680- tail = sourceText . slice ( position ) ;
679+ const head = sourceText . slice ( 0 , position ) ;
680+ var tail = sourceText . slice ( position ) ;
681681
682682 // Colourize char if stdout supports colours
683683 if ( repl . useColors ) {
@@ -697,8 +697,8 @@ function SourceInfo(body) {
697697
698698 if ( body . script ) {
699699 if ( body . script . name ) {
700- var name = body . script . name ,
701- dir = path . resolve ( ) + '/' ;
700+ var name = body . script . name ;
701+ const dir = path . resolve ( ) + '/' ;
702702
703703 // Change path to relative, if possible
704704 if ( name . indexOf ( dir ) === 0 ) {
@@ -969,8 +969,8 @@ Interface.prototype.controlEval = function(code, context, filename, callback) {
969969Interface . prototype . debugEval = function ( code , context , filename , callback ) {
970970 if ( ! this . requireConnection ( ) ) return ;
971971
972- var self = this ,
973- client = this . client ;
972+ const self = this ;
973+ const client = this . client ;
974974
975975 // Repl asked for scope variables
976976 if ( code === '.scope' ) {
@@ -1004,9 +1004,9 @@ Interface.prototype.debugEval = function(code, context, filename, callback) {
10041004// Adds spaces and prefix to number
10051005// maxN is a maximum number we should have space for
10061006function leftPad ( n , prefix , maxN ) {
1007- var s = n . toString ( ) ,
1008- nchars = Math . max ( 2 , String ( maxN ) . length ) + 1 ,
1009- nspaces = nchars - s . length - 1 ;
1007+ const s = n . toString ( ) ;
1008+ const nchars = Math . max ( 2 , String ( maxN ) . length ) + 1 ;
1009+ const nspaces = nchars - s . length - 1 ;
10101010
10111011 for ( var i = 0 ; i < nspaces ; i ++ ) {
10121012 prefix += ' ' ;
@@ -1078,10 +1078,10 @@ Interface.prototype.list = function(delta) {
10781078
10791079 delta || ( delta = 5 ) ;
10801080
1081- var self = this ,
1082- client = this . client ,
1083- from = client . currentSourceLine - delta + 1 ,
1084- to = client . currentSourceLine + delta + 1 ;
1081+ const self = this ;
1082+ const client = this . client ;
1083+ const from = client . currentSourceLine - delta + 1 ;
1084+ const to = client . currentSourceLine + delta + 1 ;
10851085
10861086 self . pause ( ) ;
10871087 client . reqSource ( from , to , function ( err , res ) {
@@ -1096,12 +1096,12 @@ Interface.prototype.list = function(delta) {
10961096 var lineno = res . fromLine + i + 1 ;
10971097 if ( lineno < from || lineno > to ) continue ;
10981098
1099- var current = lineno == 1 + client . currentSourceLine ,
1100- breakpoint = client . breakpoints . some ( function ( bp ) {
1101- return ( bp . scriptReq === client . currentScript ||
1102- bp . script === client . currentScript ) &&
1103- bp . line == lineno ;
1104- } ) ;
1099+ const current = lineno == 1 + client . currentSourceLine ;
1100+ const breakpoint = client . breakpoints . some ( function ( bp ) {
1101+ return ( bp . scriptReq === client . currentScript ||
1102+ bp . script === client . currentScript ) &&
1103+ bp . line == lineno ;
1104+ } ) ;
11051105
11061106 if ( lineno == 1 ) {
11071107 // The first line needs to have the module wrapper filtered out of
@@ -1139,8 +1139,8 @@ Interface.prototype.list = function(delta) {
11391139Interface . prototype . backtrace = function ( ) {
11401140 if ( ! this . requireConnection ( ) ) return ;
11411141
1142- var self = this ,
1143- client = this . client ;
1142+ const self = this ;
1143+ const client = this . client ;
11441144
11451145 self . pause ( ) ;
11461146 client . fullTrace ( function ( err , bt ) {
@@ -1153,8 +1153,8 @@ Interface.prototype.backtrace = function() {
11531153 if ( bt . totalFrames == 0 ) {
11541154 self . print ( '(empty stack)' ) ;
11551155 } else {
1156- var trace = [ ] ,
1157- firstFrameNative = bt . frames [ 0 ] . script . isNative ;
1156+ const trace = [ ] ;
1157+ const firstFrameNative = bt . frames [ 0 ] . script . isNative ;
11581158
11591159 for ( var i = 0 ; i < bt . frames . length ; i ++ ) {
11601160 var frame = bt . frames [ i ] ;
@@ -1183,9 +1183,9 @@ Interface.prototype.backtrace = function() {
11831183Interface . prototype . scripts = function ( ) {
11841184 if ( ! this . requireConnection ( ) ) return ;
11851185
1186- var client = this . client ,
1187- displayNatives = arguments [ 0 ] || false ,
1188- scripts = [ ] ;
1186+ const client = this . client ;
1187+ const displayNatives = arguments [ 0 ] || false ;
1188+ const scripts = [ ] ;
11891189
11901190 this . pause ( ) ;
11911191 for ( var id in client . scripts ) {
@@ -1323,9 +1323,9 @@ Interface.prototype.setBreakpoint = function(script, line,
13231323 condition , silent ) {
13241324 if ( ! this . requireConnection ( ) ) return ;
13251325
1326- var self = this ,
1327- scriptId ,
1328- ambiguous ;
1326+ const self = this ;
1327+ var scriptId ;
1328+ var ambiguous ;
13291329
13301330 // setBreakpoint() should insert breakpoint on current line
13311331 if ( script === undefined ) {
@@ -1429,10 +1429,10 @@ Interface.prototype.setBreakpoint = function(script, line,
14291429Interface . prototype . clearBreakpoint = function ( script , line ) {
14301430 if ( ! this . requireConnection ( ) ) return ;
14311431
1432- var ambiguous ,
1433- breakpoint ,
1434- scriptId ,
1435- index ;
1432+ var ambiguous ;
1433+ var breakpoint ;
1434+ var scriptId ;
1435+ var index ;
14361436
14371437 this . client . breakpoints . some ( function ( bp , i ) {
14381438 if ( bp . scriptId === script ||
@@ -1474,10 +1474,8 @@ Interface.prototype.clearBreakpoint = function(script, line) {
14741474 return this . error ( 'Breakpoint not found on line ' + line ) ;
14751475 }
14761476
1477- var self = this ,
1478- req = {
1479- breakpoint : breakpoint
1480- } ;
1477+ var self = this ;
1478+ const req = { breakpoint} ;
14811479
14821480 self . pause ( ) ;
14831481 self . client . clearBreakpoint ( req , function ( err , res ) {
@@ -1513,8 +1511,8 @@ Interface.prototype.breakpoints = function() {
15131511Interface . prototype . pause_ = function ( ) {
15141512 if ( ! this . requireConnection ( ) ) return ;
15151513
1516- var self = this ,
1517- cmd = 'process._debugPause();' ;
1514+ const self = this ;
1515+ const cmd = 'process._debugPause();' ;
15181516
15191517 this . pause ( ) ;
15201518 this . client . reqFrameEval ( cmd , NO_FRAME , function ( err , res ) {
@@ -1621,11 +1619,11 @@ Interface.prototype.killChild = function() {
16211619
16221620// Spawns child process (and restores breakpoints)
16231621Interface . prototype . trySpawn = function ( cb ) {
1624- var self = this ,
1625- breakpoints = this . breakpoints || [ ] ,
1626- port = exports . port ,
1627- host = '127.0.0.1' ,
1628- childArgs = this . args ;
1622+ const self = this ;
1623+ const breakpoints = this . breakpoints || [ ] ;
1624+ var port = exports . port ;
1625+ var host = '127.0.0.1' ;
1626+ var childArgs = this . args ;
16291627
16301628 this . killChild ( ) ;
16311629 assert ( ! this . child ) ;
@@ -1676,8 +1674,8 @@ Interface.prototype.trySpawn = function(cb) {
16761674
16771675 this . pause ( ) ;
16781676
1679- var client = self . client = new Client ( ) ,
1680- connectionAttempts = 0 ;
1677+ const client = self . client = new Client ( ) ;
1678+ var connectionAttempts = 0 ;
16811679
16821680 client . once ( 'ready' , function ( ) {
16831681 self . stdout . write ( ' ok\n' ) ;
0 commit comments