feat: corrected dummy column in overview and main page

This commit is contained in:
=
2024-10-16 12:08:29 +05:30
parent 0c3024819c
commit 6158b8a91d
8 changed files with 62 additions and 8 deletions

View File

@@ -13,3 +13,22 @@ export const groupBy = <T, Key extends string | number | symbol>(
acc[groupId].push(item);
return acc;
}, {} as Record<Key, T[]>);
/**
* Given a list of items returns a new list with only
* unique items. Accepts an optional identity function
* to convert each item in the list to a comparable identity
* value
*/
export const unique = <T, K extends string | number | symbol>(
array: readonly T[],
toKey?: (item: T) => K
): T[] => {
const valueMap = array.reduce((acc, item) => {
const key = toKey ? toKey(item) : (item as unknown as string | number | symbol);
if (acc[key]) return acc;
acc[key] = item;
return acc;
}, {} as Record<string | number | symbol, T>);
return Object.values(valueMap);
};