@@ -79,7 +79,7 @@ const kBufferedCommandSymbol = Symbol('bufferedCommand');
7979const kContextId = Symbol ( 'contextId' ) ;
8080
8181try {
82- // hack for require.resolve("./relative") to work properly.
82+ // Hack for require.resolve("./relative") to work properly.
8383module . filename = path . resolve ( 'repl' ) ;
8484} catch ( e ) {
8585// path.resolve('repl') fails when the current working directory has been
8989module . filename = path . resolve ( dirname , 'repl' ) ;
9090}
9191
92- // hack for repl require to work properly with node_modules folders
92+ // Hack for repl require to work properly with node_modules folders
9393module . paths = Module . _nodeModulePaths ( module . filename ) ;
9494
9595// If obj.hasOwnProperty has been overridden, then calling
@@ -99,14 +99,12 @@ function hasOwnProperty(obj, prop){
9999return Object . prototype . hasOwnProperty . call ( obj , prop ) ;
100100}
101101
102-
103102// Can overridden with custom print functions, such as `probe` or `eyes.js`.
104103// This is the default "writer" value if none is passed in the REPL options.
105104exports . writer = util . inspect ;
106105
107106exports . _builtinLibs = internalModule . builtinLibs ;
108107
109-
110108function REPLServer ( prompt ,
111109stream ,
112110eval_ ,
@@ -149,7 +147,6 @@ function REPLServer(prompt,
149147var self = this ;
150148
151149self . _domain = dom || domain . create ( ) ;
152-
153150self . useGlobal = ! ! useGlobal ;
154151self . ignoreUndefined = ! ! ignoreUndefined ;
155152self . replMode = replMode || exports . REPL_MODE_SLOPPY ;
@@ -162,7 +159,7 @@ function REPLServer(prompt,
162159// Context id for use with the inspector protocol.
163160self [ kContextId ] = undefined ;
164161
165- // just for backwards compat, see github.com/joyent/node/pull/7127
162+ // Just for backwards compat, see github.com/joyent/node/pull/7127
166163self . rli = this ;
167164
168165const savedRegExMatches = [ '' , '' , '' , '' , '' , '' , '' , '' , '' , '' ] ;
@@ -187,8 +184,7 @@ function REPLServer(prompt,
187184wrappedCmd = true ;
188185}
189186
190- // first, create the Script object to check the syntax
191-
187+ // First, create the Script object to check the syntax
192188if ( code === '\n' )
193189return cb ( null ) ;
194190
@@ -207,13 +203,13 @@ function REPLServer(prompt,
207203} catch ( e ) {
208204debug ( 'parse error %j' , code , e ) ;
209205if ( wrappedCmd ) {
206+ // Unwrap and try again
210207wrappedCmd = false ;
211- // unwrap and try again
212208code = input ;
213209wrappedErr = e ;
214210continue ;
215211}
216- // preserve original error for wrapped command
212+ // Preserve original error for wrapped command
217213const error = wrappedErr || e ;
218214if ( isRecoverableError ( error , code ) )
219215err = new Recoverable ( error ) ;
@@ -321,7 +317,7 @@ function REPLServer(prompt,
321317if ( ! input && ! output ) {
322318// legacy API, passing a 'stream'/'socket' option
323319if ( ! 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
325321stream = process ;
326322}
327323if ( stream . stdin && stream . stdout ) {
@@ -371,7 +367,7 @@ function REPLServer(prompt,
371367this . commands = Object . create ( null ) ;
372368defineDefaultCommands ( this ) ;
373369
374- // figure out which "writer" function to use
370+ // Figure out which "writer" function to use
375371self . writer = options . writer || exports . writer ;
376372
377373if ( options . useColors === undefined ) {
@@ -387,14 +383,14 @@ function REPLServer(prompt,
387383}
388384
389385function filterInternalStackFrames ( error , structuredStack ) {
390- // search from the bottom of the call stack to
386+ // Search from the bottom of the call stack to
391387// find the first frame with a null function name
392388if ( typeof structuredStack !== 'object' )
393389return structuredStack ;
394390const idx = structuredStack . reverse ( ) . findIndex (
395391( frame ) => frame . getFunctionName ( ) === null ) ;
396392
397- // if found, get rid of it and everything below it
393+ // If found, get rid of it and everything below it
398394structuredStack = structuredStack . splice ( idx + 1 ) ;
399395return structuredStack ;
400396}
@@ -571,7 +567,7 @@ function REPLServer(prompt,
571567return ;
572568}
573569
574- // editor mode
570+ // Editor mode
575571if ( key . ctrl && ! key . shift ) {
576572switch ( key . name ) {
577573case 'd' : // End editor mode
@@ -591,7 +587,7 @@ function REPLServer(prompt,
591587case 'down' : // Override next history item
592588break ;
593589case 'tab' :
594- // prevent double tab behavior
590+ // Prevent double tab behavior
595591self . _previousKey = null ;
596592ttyWrite ( d , key ) ;
597593break ;
@@ -861,10 +857,8 @@ function complete(line, callback){
861857}
862858
863859var completions ;
864-
865- // list of completion lists, one for each inheritance "level"
860+ // List of completion lists, one for each inheritance "level"
866861var completionGroups = [ ] ;
867-
868862var completeOn , i , group , c ;
869863
870864// REPL commands (e.g. ".break").
@@ -1042,7 +1036,7 @@ function complete(line, callback){
10421036}
10431037}
10441038} catch ( e ) {
1045- //console.log("completion error walking prototype chain:" + e);
1039+ // console.log("completion error walking prototype chain:" + e);
10461040}
10471041}
10481042
@@ -1085,7 +1079,7 @@ function complete(line, callback){
10851079}
10861080
10871081if ( completionGroups . length ) {
1088- var uniq = { } ; // unique completions across all groups
1082+ var uniq = { } ; // Unique completions across all groups
10891083completions = [ ] ;
10901084// Completion group 0 is the "closest"
10911085// (least far up the inheritance chain)
@@ -1100,7 +1094,7 @@ function complete(line, callback){
11001094uniq [ c ] = true ;
11011095}
11021096}
1103- completions . push ( '' ) ; // separator btwn groups
1097+ completions . push ( '' ) ; // Separator btwn groups
11041098}
11051099while ( completions . length && completions [ completions . length - 1 ] === '' ) {
11061100completions . pop ( ) ;
@@ -1167,7 +1161,7 @@ function _memory(cmd){
11671161self . lines = self . lines || [ ] ;
11681162self . lines . level = self . lines . level || [ ] ;
11691163
1170- // save the line so I can do magic later
1164+ // Save the line so I can do magic later
11711165if ( cmd ) {
11721166// TODO should I tab the level?
11731167const len = self . lines . level . length ? self . lines . level . length - 1 : 0 ;
@@ -1181,7 +1175,7 @@ function _memory(cmd){
11811175// Because I can not tell the difference between a } that
11821176// closes an object literal and a } that closes a function
11831177if ( cmd ) {
1184- // going down is{and ( e.g. function(){
1178+ // Going down is{and ( e.g. function(){
11851179// going up is } and )
11861180var dw = cmd . match ( / { | \( / g) ;
11871181var up = cmd . match ( / } | \) / g) ;
@@ -1192,8 +1186,8 @@ function _memory(cmd){
11921186if ( depth ) {
11931187( function workIt ( ) {
11941188if ( 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.
11971191// Since JS only has functional scope I only need to remove
11981192// "function(){" lines, clearly this will not work for
11991193// "function()
@@ -1205,16 +1199,16 @@ function _memory(cmd){
12051199isFunction : / \b f u n c t i o n \b / . test ( cmd )
12061200} ) ;
12071201} else if ( depth < 0 ) {
1208- // going ... up.
1202+ // Going ... up.
12091203var curr = self . lines . level . pop ( ) ;
12101204if ( curr ) {
12111205var tmp = curr . depth + depth ;
12121206if ( tmp < 0 ) {
1213- //more to go, recurse
1207+ // More to go, recurse
12141208depth += curr . depth ;
12151209workIt ( ) ;
12161210} else if ( tmp > 0 ) {
1217- //remove and push back
1211+ // Remove and push back
12181212curr . depth += depth ;
12191213self . lines . level . push ( curr ) ;
12201214}
0 commit comments