(input, output, completer, terminal)
| 158 | const kAddNewLineOnTTY = Symbol('_addNewLineOnTTY'); |
| 159 | |
| 160 | function InterfaceConstructor(input, output, completer, terminal) { |
| 161 | this[kSawReturnAt] = 0; |
| 162 | // TODO(BridgeAR): Document this property. The name is not ideal, so we |
| 163 | // might want to expose an alias and document that instead. |
| 164 | this.isCompletionEnabled = true; |
| 165 | this[kSawKeyPress] = false; |
| 166 | this[kPreviousKey] = null; |
| 167 | this.escapeCodeTimeout = ESCAPE_CODE_TIMEOUT; |
| 168 | this.tabSize = 8; |
| 169 | |
| 170 | FunctionPrototypeCall(EventEmitter, this); |
| 171 | |
| 172 | let crlfDelay; |
| 173 | let prompt = '> '; |
| 174 | let signal; |
| 175 | |
| 176 | if (input?.input) { |
| 177 | // An options object was given |
| 178 | output = input.output; |
| 179 | completer = input.completer; |
| 180 | terminal = input.terminal; |
| 181 | signal = input.signal; |
| 182 | |
| 183 | // It is possible to configure the history through the input object |
| 184 | const historySize = input.historySize; |
| 185 | const history = input.history; |
| 186 | const removeHistoryDuplicates = input.removeHistoryDuplicates; |
| 187 | |
| 188 | if (input.tabSize !== undefined) { |
| 189 | validateUint32(input.tabSize, 'tabSize', true); |
| 190 | this.tabSize = input.tabSize; |
| 191 | } |
| 192 | if (input.prompt !== undefined) { |
| 193 | prompt = input.prompt; |
| 194 | } |
| 195 | if (input.escapeCodeTimeout !== undefined) { |
| 196 | if (NumberIsFinite(input.escapeCodeTimeout)) { |
| 197 | this.escapeCodeTimeout = input.escapeCodeTimeout; |
| 198 | } else { |
| 199 | throw new ERR_INVALID_ARG_VALUE( |
| 200 | 'input.escapeCodeTimeout', |
| 201 | this.escapeCodeTimeout, |
| 202 | ); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | if (signal) { |
| 207 | validateAbortSignal(signal, 'options.signal'); |
| 208 | } |
| 209 | |
| 210 | crlfDelay = input.crlfDelay; |
| 211 | input = input.input; |
| 212 | |
| 213 | input.size = historySize; |
| 214 | input.history = history; |
| 215 | input.removeHistoryDuplicates = removeHistoryDuplicates; |
| 216 | } |
| 217 |
nothing calls this directly
no test coverage detected
searching dependent graphs…