typeahead: Simplify call to `this.source`.

`this.source` will always be of type `function`,
so we can remove the ternary statement. And `source`
always takes one argument, so we can remove the
second argument.
This commit is contained in:
evykassirer 2024-03-18 12:30:37 -07:00 committed by Tim Abbott
parent 954da81f4c
commit 6aee4f270e
1 changed files with 1 additions and 4 deletions

View File

@ -303,10 +303,7 @@ Typeahead.prototype = {
return this.shown ? this.hide() : this; return this.shown ? this.hide() : this;
} }
const items = const items = this.source(this.query);
typeof this.source === "function"
? this.source(this.query, this.process.bind(this))
: this.source;
if (!items && this.shown) { if (!items && this.shown) {
this.hide(); this.hide();