mirror of
https://github.com/t4t5/nostr-react.git
synced 2025-03-20 14:53:12 +01:00
12 lines
205 B
TypeScript
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,
|
|
}),
|
|
{}
|
|
)
|
|
);
|
|
};
|