Skip to content

Commit 433c6df

Browse files
LiviaMedeirosguangwong
authored andcommitted
readline: use kEmptyObject
PR-URL: nodejs/node#43159 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent b85023f commit 433c6df

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/internal/readline/interface.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const {
4343
validateString,
4444
validateUint32,
4545
} = require('internal/validators');
46+
const { kEmptyObject } = require('internal/util');
4647
const {
4748
inspect,
4849
getStringWidth,
@@ -922,7 +923,7 @@ class Interface extends InterfaceConstructor {
922923
// Handle a write from the tty
923924
[kTtyWrite](s, key) {
924925
const previousKey = this[kPreviousKey];
925-
key = key || {};
926+
key = key || kEmptyObject;
926927
this[kPreviousKey] = key;
927928

928929
// Activate or deactivate substring search.

lib/readline.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ const {
100100
kSubstringSearch,
101101
} = require('internal/readline/utils');
102102

103-
const { promisify } = require('internal/util');
103+
const {
104+
kEmptyObject,
105+
promisify,
106+
} = require('internal/util');
104107

105108
const { StringDecoder } = require('string_decoder');
106109

@@ -987,7 +990,7 @@ Interface.prototype._moveCursor = function(dx) {
987990
};
988991

989992
function _ttyWriteDumb(s, key) {
990-
key = key || {};
993+
key = key || kEmptyObject;
991994

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

0 commit comments

Comments
 (0)