1const addresses = [...]; // Some array I got from async call
2
3const uniqueAddresses = Array.from(new Set(addresses.map(a => a.id)))
4 .map(id => {
5 return addresses.find(a => a.id === id)
6 })
1function remove_duplicate_objects(data,prop) {
2 var seen = {};
3 data = data.filter(function (entry) {
4 if (seen.hasOwnProperty(entry[prop])) {
5 return false;
6 }
7
8 seen[entry.prop] = entry;
9 return true;
10 });
11 return data
12 }
13
14const new_array = remove_duplicate_objects([array with objects inside])