const unique = (arr: any[], valFn: (item) => any) => { const values = {}; return arr.filter(item => { const val = String(valFn(item)); return val in values ? false : values[val] = true; }); }; // unique(data, d => d.id)
228700cookie-checkTypescript filter duplicates