Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
readline: refactor filter() callback
Use construct that always returns a boolean for `filter()` callback.
  • Loading branch information
Trott committed Dec 27, 2017
commit d018b7bf63186c981d1fb68853d29d9437eb0956
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