Lint project

This commit is contained in:
Kurt Hutten
2020-11-11 03:18:10 +11:00
parent d8efead4e8
commit 39898270df
33 changed files with 852 additions and 481 deletions

View File

@@ -2,9 +2,12 @@ export const countEmotes = (reactions = []) => {
// would be good to do this sever side
// counting unique emojis, and limiting to the 5 largest
const emoteCounts = {}
reactions.forEach(({emote}) => {
reactions.forEach(({ emote }) => {
emoteCounts[emote] = emoteCounts[emote] ? emoteCounts[emote] + 1 : 1
})
// TODO the sort is causing the emotes to jump around after the user clicks one, not ideal
return Object.entries(emoteCounts).map(([emoji, count]) => ({emoji, count})).sort((a,b) => a.count-b.count).slice(-5)
return Object.entries(emoteCounts)
.map(([emoji, count]) => ({ emoji, count }))
.sort((a, b) => a.count - b.count)
.slice(-5)
}