Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d64e237

Browse filesBrowse files
JacksonTianItalo A. Casas
authored andcommitted
readline: refactor construct Interface
Remove the dependency on the arguments.length. PR-URL: #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>
1 parent 7d917dc commit d64e237
Copy full SHA for d64e237

File tree

Expand file treeCollapse file tree

1 file changed

+3
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-12
lines changed
Open diff view settings
Collapse file

‎lib/readline.js‎

Copy file name to clipboardExpand all lines: lib/readline.js
+3-12Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,13 @@ const stripVTControlCharacters = internalReadline.stripVTControlCharacters;
2323

2424

2525
exports.createInterface = function(input, output, completer, terminal) {
26-
var rl;
27-
if (arguments.length === 1) {
28-
rl = new Interface(input);
29-
} else {
30-
rl = new Interface(input, output, completer, terminal);
31-
}
32-
return rl;
26+
return new Interface(input, output, completer, terminal);
3327
};
3428

3529

3630
function Interface(input, output, completer, terminal) {
3731
if (!(this instanceof Interface)) {
38-
// call the constructor preserving original number of arguments
39-
const self = Object.create(Interface.prototype);
40-
Interface.apply(self, arguments);
41-
return self;
32+
return new Interface(input, output, completer, terminal);
4233
}
4334

4435
this._sawReturnAt = 0;
@@ -51,7 +42,7 @@ function Interface(input, output, completer, terminal) {
5142
let crlfDelay;
5243
let prompt = '> ';
5344

54-
if (arguments.length === 1) {
45+
if (input && input.input) {
5546
// an options object was given
5647
output = input.output;
5748
completer = input.completer;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.