add sort by unread count util

This commit is contained in:
Ajay Bura 2024-02-04 12:25:55 +05:30
parent 9ab16edb4b
commit 69727735b7

View file

@ -30,3 +30,11 @@ export const factoryRoomIdByAtoZ =
}
return 0;
};
export const factoryRoomIdByUnreadCount =
(getUnreadCount: (roomId: string) => number): SortFunc<string> =>
(a, b) => {
const aT = getUnreadCount(a) ?? 0;
const bT = getUnreadCount(b) ?? 0;
return bT - aT;
};