js: Convert static/js/search_util.js to ES6 module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-02-10 07:45:43 -08:00
committed by Tim Abbott
parent a6bf97057b
commit 8bbb0d9193
6 changed files with 5 additions and 12 deletions

View File

@@ -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;
}