Skip to content

Commit b1bc768

Browse files
TrottMylesBorins
authored andcommitted
readline: refactor filter() callback
Use construct that always returns a boolean for `filter()` callback. PR-URL: #17858 Reviewed-By: Weijia Wang <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent b15f029 commit b1bc768

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/readline.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,7 @@ Interface.prototype._tabComplete = function(lastKeypressWasTab) {
500500
}
501501

502502
// If there is a common prefix to all matches, then apply that portion.
503-
var f = completions.filter(function completionFilter(e) {
504-
if (e) return e;
505-
});
503+
var f = completions.filter((e) => e);
506504
var prefix = commonPrefix(f);
507505
if (prefix.length > completeOn.length) {
508506
self._insertString(prefix.slice(completeOn.length));

0 commit comments

Comments
 (0)