readline: refactor filter() callback
Use construct that always returns a boolean for `filter()` callback. PR-URL: https://github.com/nodejs/node/pull/17858 Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
286a5d0e74
commit
5c7af90cbf
@ -500,9 +500,7 @@ Interface.prototype._tabComplete = function(lastKeypressWasTab) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If there is a common prefix to all matches, then apply that portion.
|
// If there is a common prefix to all matches, then apply that portion.
|
||||||
var f = completions.filter(function completionFilter(e) {
|
var f = completions.filter((e) => e);
|
||||||
if (e) return e;
|
|
||||||
});
|
|
||||||
var prefix = commonPrefix(f);
|
var prefix = commonPrefix(f);
|
||||||
if (prefix.length > completeOn.length) {
|
if (prefix.length > completeOn.length) {
|
||||||
self._insertString(prefix.slice(completeOn.length));
|
self._insertString(prefix.slice(completeOn.length));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user