Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

typeahead: Use `startsWith` instead of a falsey index check.

evykassirerbb68dde1da02
diff --git a/web/third/bootstrap-typeahead/typeahead.js b/web/third/bootstrap-typeahead/typeahead.js
index f6353e0e6be..44deddbf40a 100644
--- a/web/third/bootstrap-typeahead/typeahead.js
+++ b/web/third/bootstrap-typeahead/typeahead.js
@@ -350,7 +350,7 @@ import {get_string_diff} from "../../src/util";
let item;
while ((item = items.shift())) {
- if (!item.toLowerCase().indexOf(this.query.toLowerCase())) {
+ if (item.toLowerCase().startsWith(this.query.toLowerCase())) {
beginswith.push(item);
} else if (item.includes(this.query)) {
caseSensitive.push(item);