client: Sort emojis by query similarity in fuzzy picker #156
1 changed files with 1 additions and 1 deletions
|
@ -150,7 +150,7 @@ function emojiSearch<Type extends foundkey.entities.CustomEmoji|UnicodeEmojiDef>
|
|||
const joinq = query.replace(/\s+/g, '');
|
||||
const distance = (str: string): number => rodistance(joinq, str);
|
||||
const mindistance = (strs: string[]): number => Math.min(...strs.map(distance));
|
||||
const distinguisher = (emoji: Type): string => 'char' in emoji ? emoji.char : emoji.name;
|
||||
const distinguisher = (emoji: Type): string => 'char' in emoji ? emoji.char : emoji.id;
|
||||
matches.forEach(emoji => distances[distinguisher(emoji)] = Math.min(distance(emoji.name), mindistance(aliases(emoji))));
|
||||
Michcio marked this conversation as resolved
Outdated
|
||||
|
||||
// sort by distance from query
|
||||
|
|
Loading…
Reference in a new issue
Is there a reason
forEach
is used instead offor (const emoji of matches)
?No, it just wasn't an error. I too prefer
for (...)
.