Files
zulip/static/js/search_util.js
Anders Kaseorg d17b577d0c js: Purge useless IIFEs.
With webpack, variables declared in each file are already file-local
(Global variables need to be explicitly exported), so these IIFEs are
no longer needed.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-25 13:51:21 -07:00

28 lines
742 B
JavaScript

exports.get_search_terms = function (input) {
var search_terms = input.toLowerCase().split(",").map(function (s) {
return s.trim();
});
return search_terms;
};
exports.vanilla_match = function (opts) {
/*
This is a pretty vanilla search criteria
where we see if any of our search terms
is in our value. When in doubt we should use
this for all Zulip filters, but we may
have more complicated use cases in some
places.
This is case insensitive.
*/
var val = opts.val.toLowerCase();
return _.any(opts.search_terms, function (term) {
if (val.indexOf(term) !== -1) {
return true;
}
});
};
window.search_util = exports;