make code more readable as per pr suggestion
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
3a0e1aeeaf
commit
e114effcfa
1 changed files with 1 additions and 3 deletions
|
@ -101,9 +101,7 @@ export default class EmojiProvider extends AutocompleteProvider {
|
||||||
// then sort by score (Infinity if matchedString not in shortname)
|
// then sort by score (Infinity if matchedString not in shortname)
|
||||||
sorters.push((c) => score(matchedString, c.shortname));
|
sorters.push((c) => score(matchedString, c.shortname));
|
||||||
// then sort by max score of all shortcodes, trim off the `:`
|
// then sort by max score of all shortcodes, trim off the `:`
|
||||||
sorters.push((c) => {
|
sorters.push((c) => Math.min(...c.emoji.shortcodes.map(s => score(matchedString.substring(1), s))));
|
||||||
return Math.min.apply(null, c.emoji.shortcodes.map(s => score(matchedString.substring(1), s)));
|
|
||||||
});
|
|
||||||
// If the matchedString is not empty, sort by length of shortname. Example:
|
// If the matchedString is not empty, sort by length of shortname. Example:
|
||||||
// matchedString = ":bookmark"
|
// matchedString = ":bookmark"
|
||||||
// completions = [":bookmark:", ":bookmark_tabs:", ...]
|
// completions = [":bookmark:", ":bookmark_tabs:", ...]
|
||||||
|
|
Loading…
Reference in a new issue