diff options
Diffstat (limited to 'lib/repl.js')
-rw-r--r-- | lib/repl.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/repl.js b/lib/repl.js index ecb75f516b..52ae11c3a3 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -137,14 +137,14 @@ REPLServer.prototype.readline = function (cmd) { /** * Used to parse and execute the Node REPL commands. - * + * * @param {cmd} cmd The command entered to check - * @returns {Boolean} If true it means don't continue parsing the command + * @returns {Boolean} If true it means don't continue parsing the command */ REPLServer.prototype.parseREPLKeyword = function (cmd) { var self = this; - + switch (cmd) { case ".break": self.buffered_cmd = ''; @@ -171,7 +171,7 @@ REPLServer.prototype.parseREPLKeyword = function (cmd) { }; function trimWhitespace (cmd) { - var trimmer = /^\s*(.+)\s*$/m, + var trimmer = /^\s*(.+)\s*$/m, matches = trimmer.exec(cmd); if (matches && matches.length === 2) { @@ -183,7 +183,7 @@ function trimWhitespace (cmd) { * Converts commands that use var and function <name>() to use the * local exports.context when evaled. This provides a local context * on the REPL. - * + * * @param {String} cmd The cmd to convert * @returns {String} The converted command */ @@ -191,18 +191,18 @@ REPLServer.prototype.convertToContext = function (cmd) { var self = this, matches, scopeVar = /^\s*var\s*([_\w\$]+)(.*)$/m, scopeFunc = /^\s*function\s*([_\w\$]+)/; - + // Replaces: var foo = "bar"; with: self.context.foo = bar; matches = scopeVar.exec(cmd); if (matches && matches.length === 3) { return "self.context." + matches[1] + matches[2]; } - + // Replaces: function foo() {}; with: foo = function foo() {}; matches = scopeFunc.exec(self.buffered_cmd); if (matches && matches.length === 2) { return matches[1] + " = " + self.buffered_cmd; } - + return cmd; }; |