| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7d917dc commit d64e237
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,22 +23,13 @@ const stripVTControlCharacters = internalReadline.stripVTControlCharacters; | |||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | 25 | 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); | ||
| 33 | 27 | }; | |
| 34 | 28 | ||
| 35 | 29 | ||
| 36 | 30 | function Interface(input, output, completer, terminal) { | |
| 37 | 31 | 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); | ||
| 42 | 33 | } | |
| 43 | 34 | ||
| 44 | 35 | this._sawReturnAt = 0; | |
@@ -51,7 +42,7 @@ function Interface(input, output, completer, terminal) { | |||
| 51 | 42 | let crlfDelay; | |
| 52 | 43 | let prompt = '> '; | |
| 53 | 44 | ||
| 54 | - if (arguments.length === 1) { | ||
| 45 | + if (input && input.input) { | ||
| 55 | 46 | // an options object was given | |
| 56 | 47 | output = input.output; | |
| 57 | 48 | completer = input.completer; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments