@@ -79,7 +79,7 @@ const kBufferedCommandSymbol = Symbol('bufferedCommand');
79
79
const kContextId = Symbol ( 'contextId' ) ;
80
80
81
81
try {
82
- // hack for require.resolve("./relative") to work properly.
82
+ // Hack for require.resolve("./relative") to work properly.
83
83
module . filename = path . resolve ( 'repl' ) ;
84
84
} catch ( e ) {
85
85
// path.resolve('repl') fails when the current working directory has been
89
89
module . filename = path . resolve ( dirname , 'repl' ) ;
90
90
}
91
91
92
- // hack for repl require to work properly with node_modules folders
92
+ // Hack for repl require to work properly with node_modules folders
93
93
module . paths = Module . _nodeModulePaths ( module . filename ) ;
94
94
95
95
// If obj.hasOwnProperty has been overridden, then calling
@@ -99,14 +99,12 @@ function hasOwnProperty(obj, prop) {
99
99
return Object . prototype . hasOwnProperty . call ( obj , prop ) ;
100
100
}
101
101
102
-
103
102
// Can overridden with custom print functions, such as `probe` or `eyes.js`.
104
103
// This is the default "writer" value if none is passed in the REPL options.
105
104
exports . writer = util . inspect ;
106
105
107
106
exports . _builtinLibs = internalModule . builtinLibs ;
108
107
109
-
110
108
function REPLServer ( prompt ,
111
109
stream ,
112
110
eval_ ,
@@ -149,7 +147,6 @@ function REPLServer(prompt,
149
147
var self = this ;
150
148
151
149
self . _domain = dom || domain . create ( ) ;
152
-
153
150
self . useGlobal = ! ! useGlobal ;
154
151
self . ignoreUndefined = ! ! ignoreUndefined ;
155
152
self . replMode = replMode || exports . REPL_MODE_SLOPPY ;
@@ -162,7 +159,7 @@ function REPLServer(prompt,
162
159
// Context id for use with the inspector protocol.
163
160
self [ kContextId ] = undefined ;
164
161
165
- // just for backwards compat, see github.com/joyent/node/pull/7127
162
+ // Just for backwards compat, see github.com/joyent/node/pull/7127
166
163
self . rli = this ;
167
164
168
165
const savedRegExMatches = [ '' , '' , '' , '' , '' , '' , '' , '' , '' , '' ] ;
@@ -187,8 +184,7 @@ function REPLServer(prompt,
187
184
wrappedCmd = true ;
188
185
}
189
186
190
- // first, create the Script object to check the syntax
191
-
187
+ // First, create the Script object to check the syntax
192
188
if ( code === '\n' )
193
189
return cb ( null ) ;
194
190
@@ -207,13 +203,13 @@ function REPLServer(prompt,
207
203
} catch ( e ) {
208
204
debug ( 'parse error %j' , code , e ) ;
209
205
if ( wrappedCmd ) {
206
+ // Unwrap and try again
210
207
wrappedCmd = false ;
211
- // unwrap and try again
212
208
code = input ;
213
209
wrappedErr = e ;
214
210
continue ;
215
211
}
216
- // preserve original error for wrapped command
212
+ // Preserve original error for wrapped command
217
213
const error = wrappedErr || e ;
218
214
if ( isRecoverableError ( error , code ) )
219
215
err = new Recoverable ( error ) ;
@@ -321,7 +317,7 @@ function REPLServer(prompt,
321
317
if ( ! input && ! output ) {
322
318
// legacy API, passing a 'stream'/'socket' option
323
319
if ( ! stream ) {
324
- // use stdin and stdout as the default streams if none were given
320
+ // Use stdin and stdout as the default streams if none were given
325
321
stream = process ;
326
322
}
327
323
if ( stream . stdin && stream . stdout ) {
@@ -371,7 +367,7 @@ function REPLServer(prompt,
371
367
this . commands = Object . create ( null ) ;
372
368
defineDefaultCommands ( this ) ;
373
369
374
- // figure out which "writer" function to use
370
+ // Figure out which "writer" function to use
375
371
self . writer = options . writer || exports . writer ;
376
372
377
373
if ( options . useColors === undefined ) {
@@ -387,14 +383,14 @@ function REPLServer(prompt,
387
383
}
388
384
389
385
function filterInternalStackFrames ( error , structuredStack ) {
390
- // search from the bottom of the call stack to
386
+ // Search from the bottom of the call stack to
391
387
// find the first frame with a null function name
392
388
if ( typeof structuredStack !== 'object' )
393
389
return structuredStack ;
394
390
const idx = structuredStack . reverse ( ) . findIndex (
395
391
( frame ) => frame . getFunctionName ( ) === null ) ;
396
392
397
- // if found, get rid of it and everything below it
393
+ // If found, get rid of it and everything below it
398
394
structuredStack = structuredStack . splice ( idx + 1 ) ;
399
395
return structuredStack ;
400
396
}
@@ -571,7 +567,7 @@ function REPLServer(prompt,
571
567
return ;
572
568
}
573
569
574
- // editor mode
570
+ // Editor mode
575
571
if ( key . ctrl && ! key . shift ) {
576
572
switch ( key . name ) {
577
573
case 'd' : // End editor mode
@@ -591,7 +587,7 @@ function REPLServer(prompt,
591
587
case 'down' : // Override next history item
592
588
break ;
593
589
case 'tab' :
594
- // prevent double tab behavior
590
+ // Prevent double tab behavior
595
591
self . _previousKey = null ;
596
592
ttyWrite ( d , key ) ;
597
593
break ;
@@ -861,10 +857,8 @@ function complete(line, callback) {
861
857
}
862
858
863
859
var completions ;
864
-
865
- // list of completion lists, one for each inheritance "level"
860
+ // List of completion lists, one for each inheritance "level"
866
861
var completionGroups = [ ] ;
867
-
868
862
var completeOn , i , group , c ;
869
863
870
864
// REPL commands (e.g. ".break").
@@ -1042,7 +1036,7 @@ function complete(line, callback) {
1042
1036
}
1043
1037
}
1044
1038
} catch ( e ) {
1045
- //console.log("completion error walking prototype chain:" + e);
1039
+ // console.log("completion error walking prototype chain:" + e);
1046
1040
}
1047
1041
}
1048
1042
@@ -1085,7 +1079,7 @@ function complete(line, callback) {
1085
1079
}
1086
1080
1087
1081
if ( completionGroups . length ) {
1088
- var uniq = { } ; // unique completions across all groups
1082
+ var uniq = { } ; // Unique completions across all groups
1089
1083
completions = [ ] ;
1090
1084
// Completion group 0 is the "closest"
1091
1085
// (least far up the inheritance chain)
@@ -1100,7 +1094,7 @@ function complete(line, callback) {
1100
1094
uniq [ c ] = true ;
1101
1095
}
1102
1096
}
1103
- completions . push ( '' ) ; // separator btwn groups
1097
+ completions . push ( '' ) ; // Separator btwn groups
1104
1098
}
1105
1099
while ( completions . length && completions [ completions . length - 1 ] === '' ) {
1106
1100
completions . pop ( ) ;
@@ -1167,7 +1161,7 @@ function _memory(cmd) {
1167
1161
self . lines = self . lines || [ ] ;
1168
1162
self . lines . level = self . lines . level || [ ] ;
1169
1163
1170
- // save the line so I can do magic later
1164
+ // Save the line so I can do magic later
1171
1165
if ( cmd ) {
1172
1166
// TODO should I tab the level?
1173
1167
const len = self . lines . level . length ? self . lines . level . length - 1 : 0 ;
@@ -1181,7 +1175,7 @@ function _memory(cmd) {
1181
1175
// Because I can not tell the difference between a } that
1182
1176
// closes an object literal and a } that closes a function
1183
1177
if ( cmd ) {
1184
- // going down is { and ( e.g. function() {
1178
+ // Going down is { and ( e.g. function() {
1185
1179
// going up is } and )
1186
1180
var dw = cmd . match ( / { | \( / g) ;
1187
1181
var up = cmd . match ( / } | \) / g) ;
@@ -1192,8 +1186,8 @@ function _memory(cmd) {
1192
1186
if ( depth ) {
1193
1187
( function workIt ( ) {
1194
1188
if ( depth > 0 ) {
1195
- // going ... down.
1196
- // push the line#, depth count, and if the line is a function.
1189
+ // Going ... down.
1190
+ // Push the line#, depth count, and if the line is a function.
1197
1191
// Since JS only has functional scope I only need to remove
1198
1192
// "function() {" lines, clearly this will not work for
1199
1193
// "function()
@@ -1205,16 +1199,16 @@ function _memory(cmd) {
1205
1199
isFunction : / \b f u n c t i o n \b / . test ( cmd )
1206
1200
} ) ;
1207
1201
} else if ( depth < 0 ) {
1208
- // going ... up.
1202
+ // Going ... up.
1209
1203
var curr = self . lines . level . pop ( ) ;
1210
1204
if ( curr ) {
1211
1205
var tmp = curr . depth + depth ;
1212
1206
if ( tmp < 0 ) {
1213
- //more to go, recurse
1207
+ // More to go, recurse
1214
1208
depth += curr . depth ;
1215
1209
workIt ( ) ;
1216
1210
} else if ( tmp > 0 ) {
1217
- //remove and push back
1211
+ // Remove and push back
1218
1212
curr . depth += depth ;
1219
1213
self . lines . level . push ( curr ) ;
1220
1214
}
0 commit comments