remove duplicates from an array

up:: JavaScript

// uniq - remove duplicates from the array
// https://stackoverflow.com/a/56768137
 
// comparing by id
const uniq = (arr: Array): array => {
  return [...new Map(arr.map((item) => [item.id, item])).values()];
};