mirror of https://github.com/zulip/zulip.git
js: Convert static/js/search_util.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
a6bf97057b
commit
8bbb0d9193
|
@ -242,7 +242,6 @@
|
|||
"search_pill": false,
|
||||
"search_pill_widget": false,
|
||||
"search_suggestion": false,
|
||||
"search_util": false,
|
||||
"sent_messages": false,
|
||||
"server_events": false,
|
||||
"server_events_dispatch": false,
|
||||
|
|
|
@ -12,7 +12,6 @@ const ui = set_global("ui", {
|
|||
get_scroll_element: (element) => element,
|
||||
});
|
||||
const stream_data = zrequire("stream_data");
|
||||
zrequire("search_util");
|
||||
set_global("page_params", {});
|
||||
|
||||
const denmark_stream_id = 101;
|
||||
|
|
|
@ -16,7 +16,6 @@ import "flatpickr/dist/plugins/confirmDate/confirmDate";
|
|||
import "../i18n";
|
||||
import "../loading";
|
||||
import "../vdom";
|
||||
import "../search_util";
|
||||
import "../keydown_util";
|
||||
import "../lightbox_canvas";
|
||||
import "../rtl";
|
||||
|
|
|
@ -110,7 +110,6 @@ declare let search: any;
|
|||
declare let search_pill: any;
|
||||
declare let search_pill_widget: any;
|
||||
declare let search_suggestion: any;
|
||||
declare let search_util: any;
|
||||
declare let sent_messages: any;
|
||||
declare let server_events: any;
|
||||
declare let server_events_dispatch: any;
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
exports.get_search_terms = function (input) {
|
||||
export function get_search_terms(input) {
|
||||
const search_terms = input
|
||||
.toLowerCase()
|
||||
.split(",")
|
||||
.map((s) => s.trim());
|
||||
return search_terms;
|
||||
};
|
||||
}
|
||||
|
||||
exports.vanilla_match = function (opts) {
|
||||
export function vanilla_match(opts) {
|
||||
/*
|
||||
This is a pretty vanilla search criteria
|
||||
where we see if any of our search terms
|
||||
|
@ -21,6 +19,4 @@ exports.vanilla_match = function (opts) {
|
|||
*/
|
||||
const val = opts.val.toLowerCase();
|
||||
return opts.search_terms.some((term) => val.includes(term));
|
||||
};
|
||||
|
||||
window.search_util = exports;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ const render_subscription_table_body = require("../templates/subscription_table_
|
|||
const render_subscriptions = require("../templates/subscriptions.hbs");
|
||||
|
||||
const people = require("./people");
|
||||
const search_util = require("./search_util");
|
||||
const util = require("./util");
|
||||
|
||||
exports.show_subs_pane = {
|
||||
|
|
Loading…
Reference in New Issue