nostr-react/src/utils.ts
2022-12-20 06:47:32 +00:00

12 lines
205 B
TypeScript

export const uniqBy = <T>(arr: T[], key: keyof T): T[] => {
return Object.values(
arr.reduce(
(map, item) => ({
...map,
[`${item[key]}`]: item,
}),
{}
)
);
};