Skip to content

Commit

Permalink
readline: use kEmptyObject
Browse files Browse the repository at this point in the history
PR-URL: #43159
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
LiviaMedeiros authored and targos committed Jul 31, 2022
1 parent f08a282 commit 37066f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/internal/readline/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const {
validateString,
validateUint32,
} = require('internal/validators');
const { kEmptyObject } = require('internal/util');
const {
inspect,
getStringWidth,
Expand Down Expand Up @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -987,7 +990,7 @@ Interface.prototype._moveCursor = function(dx) {
};

function _ttyWriteDumb(s, key) {
key = key || {};
key = key || kEmptyObject;

if (key.name === 'escape') return;

Expand Down

0 comments on commit 37066f0

Please sign in to comment.