top of page
All Posts
Finding Top Ten From Large Object With TypeScript
This example uses X / Twitter hashtags as an example but the same method generalizes to any data where you have keys and each key can occur more than once. This solution takes no stance on the following: How to query the data from a DB—we assume the data is provided from an API. If it would be more optimal to perform the count computation directly in DB rather than on the backend. Solution type HashtagCount = [string, number] //[hashtag, count] type TopHashtags = Array<Hasht
Sami Nieminen
Sep 92 min read
bottom of page