mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	And convert the corresponding function expressions to arrow style while we’re here. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
		
			
				
	
	
		
			24 lines
		
	
	
		
			672 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			672 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
exports.get_search_terms = function (input) {
 | 
						|
    const 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.
 | 
						|
    */
 | 
						|
    const val = opts.val.toLowerCase();
 | 
						|
    return opts.search_terms.some(term => val.includes(term));
 | 
						|
};
 | 
						|
 | 
						|
window.search_util = exports;
 |