mirror of
https://github.com/iptv-org/epg
synced 2026-04-23 02:57:04 -04:00
continuing, WIP
This commit is contained in:
@@ -11,8 +11,7 @@
|
||||
* const uniqueItems = uniqBy(items, item => item.id);
|
||||
* // uniqueItems will be [{ id: 1, name: 'A' }, { id: 2, name: 'B' }]
|
||||
*/
|
||||
export const uniqBy = <T, K>(arr: T[], fn: (item: T) => K): T[] =>
|
||||
Array.from(new Map(arr.map(item => [fn(item), item])).values())
|
||||
export const uniqBy = <T, K>(arr: T[], fn: (item: T) => K): T[] => [...new Map(arr.map(x => [fn(x), x])).values()]
|
||||
|
||||
/**
|
||||
* Recursively merges multiple objects into a single object.
|
||||
|
||||
Reference in New Issue
Block a user