2 * Extract the elements from an array that are unique according to a comparator function
4 const uniqueBy = <T>(array: T[], comparator: (t: T) => any) => {
5 const seen = new Set();
6 return array.filter((value) => {
7 const computed = comparator(value);
8 const hasSeen = seen.has(computed);
16 export default uniqueBy;