Skip to content

Commit

Permalink
readline: refactor filter() callback
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott authored and MylesBorins committed Jan 9, 2018
1 parent b15f029 commit b1bc768
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,7 @@ Interface.prototype._tabComplete = function(lastKeypressWasTab) {
}

// If there is a common prefix to all matches, then apply that portion.
var f = completions.filter(function completionFilter(e) {
if (e) return e;
});
var f = completions.filter((e) => e);
var prefix = commonPrefix(f);
if (prefix.length > completeOn.length) {
self._insertString(prefix.slice(completeOn.length));
Expand Down

0 comments on commit b1bc768

Please sign in to comment.