diff options
author | Jackson Tian <shyvo1987@gmail.com> | 2016-01-18 17:51:15 +0800 |
---|---|---|
committer | Jackson Tian <shyvo1987@gmail.com> | 2017-01-13 22:49:35 +0800 |
commit | dad98bfe3268fba1d5910ed8bdf62fe611b41c55 (patch) | |
tree | 092039677a3c5363d88fbf97e3b1a5e1e637f62a /lib/readline.js | |
parent | 57f6a106fbc69a47ece42bab9f3f9c65c2c6150b (diff) | |
download | android-node-v8-dad98bfe3268fba1d5910ed8bdf62fe611b41c55.tar.gz android-node-v8-dad98bfe3268fba1d5910ed8bdf62fe611b41c55.tar.bz2 android-node-v8-dad98bfe3268fba1d5910ed8bdf62fe611b41c55.zip |
readline: refactor construct Interface
Remove the dependency on the arguments.length.
PR-URL: https://github.com/nodejs/node/pull/4740
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'lib/readline.js')
-rw-r--r-- | lib/readline.js | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/readline.js b/lib/readline.js index 9b925a6d99..8200771ec4 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -23,22 +23,13 @@ const stripVTControlCharacters = internalReadline.stripVTControlCharacters; exports.createInterface = function(input, output, completer, terminal) { - var rl; - if (arguments.length === 1) { - rl = new Interface(input); - } else { - rl = new Interface(input, output, completer, terminal); - } - return rl; + return new Interface(input, output, completer, terminal); }; function Interface(input, output, completer, terminal) { if (!(this instanceof Interface)) { - // call the constructor preserving original number of arguments - const self = Object.create(Interface.prototype); - Interface.apply(self, arguments); - return self; + return new Interface(input, output, completer, terminal); } this._sawReturnAt = 0; @@ -51,7 +42,7 @@ function Interface(input, output, completer, terminal) { let crlfDelay; let prompt = '> '; - if (arguments.length === 1) { + if (input && input.input) { // an options object was given output = input.output; completer = input.completer; |