I'm trying create a set to insert objects avoiding duplicates.
When I do this:
const orgs = new Set();
set.add({
org_name: org.org_name,
relation_type: OrganisationRelationType.SELF,
related_org: org.org_name
});
set.add({
org_name: org.org_name,
relation_type: OrganisationRelationType.SELF,
related_org: org.org_name
});
I get the following output:
Set{
{
org_name: org.org_name,
relation_type: OrganisationRelationType.SELF,
related_org: org.org_name
},
{
org_name: org.org_name,
relation_type: OrganisationRelationType.SELF,
related_org: org.org_name
}
}
Instead of getting this:
Set{
{
org_name: org.org_name,
relation_type: OrganisationRelationType.SELF,
related_org: org.org_name
}
}
How can I add to this Set avoiding duplicates in an efficient way?