Emoji completion: reverse results to show higher results at the top

This commit is contained in:
Scott Nonnenberg 2020-12-04 11:27:51 -08:00 committed by GitHub
parent 6af78be51a
commit 56ae4a41eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,7 +219,8 @@ const fuse = new Fuse(data, {
});
export function search(query: string, count = 0): Array<EmojiData> {
const results = fuse.search(query.substr(0, 32));
// We reverse it because fuse returns low-score results first!
const results = fuse.search(query.substr(0, 32)).reverse();
if (count) {
return take(results, count);