diff --git a/lib/internal/readline/interface.js b/lib/internal/readline/interface.js index e50172f5628ccc..63383658879095 100644 --- a/lib/internal/readline/interface.js +++ b/lib/internal/readline/interface.js @@ -43,6 +43,7 @@ const { validateString, validateUint32, } = require('internal/validators'); +const { kEmptyObject } = require('internal/util'); const { inspect, getStringWidth, @@ -922,7 +923,7 @@ class Interface extends InterfaceConstructor { // Handle a write from the tty [kTtyWrite](s, key) { const previousKey = this[kPreviousKey]; - key = key || {}; + key = key || kEmptyObject; this[kPreviousKey] = key; // Activate or deactivate substring search. diff --git a/lib/readline.js b/lib/readline.js index fa21c82f7158c2..7e55c99e65be23 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -100,7 +100,10 @@ const { kSubstringSearch, } = require('internal/readline/utils'); -const { promisify } = require('internal/util'); +const { + kEmptyObject, + promisify, +} = require('internal/util'); const { StringDecoder } = require('string_decoder'); @@ -987,7 +990,7 @@ Interface.prototype._moveCursor = function(dx) { }; function _ttyWriteDumb(s, key) { - key = key || {}; + key = key || kEmptyObject; if (key.name === 'escape') return;