mirror of
https://github.com/t4t5/nostr-react.git
synced 2025-03-21 23:32:35 +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,
|
||
|
}),
|
||
|
{}
|
||
|
)
|
||
|
);
|
||
|
};
|