refactor: Rename query_matches_string to query_matches_string_in_order.

The function is renamed for clarity.

Prep commit for next commit which adds a similar function where order
does not matter.
This commit is contained in:
N-Shar-ma
2023-03-11 00:06:46 +05:30
committed by Tim Abbott
parent 5d83e53ca5
commit c503a846ba
2 changed files with 8 additions and 8 deletions

View File

@@ -54,7 +54,7 @@ export function remove_diacritics(s: string): string {
// * query is the user-entered search query
// * source_str is the string we're matching in, e.g. a user's name
// * split_char is the separator for this syntax (e.g. ' ').
export function query_matches_string(
export function query_matches_string_in_order(
query: string,
source_str: string,
split_char: string,
@@ -111,7 +111,7 @@ export function get_emoji_matcher(query: string): (emoji: Emoji) => boolean {
const matches_emoji_literal =
emoji.reaction_type === "unicode_emoji" &&
parse_unicode_emoji_code(emoji.emoji_code) === query;
return matches_emoji_literal || query_matches_string(query, emoji.emoji_name, "_");
return matches_emoji_literal || query_matches_string_in_order(query, emoji.emoji_name, "_");
};
}