I have a requirement to remove repeated objects from an array based on certain condition check If any of the object with same "connector", "address", "type" values in this array i need remove that object.
array = [{
connector : 'smtp',
name : 'john',
address : 'john@gmail.com',
type : 'cc'
}, {
connector : 'smtp',
name : 'john',
address : 'john@gmail.com',
type : 'cc'
}, {
connector : 'gtp',
name : 'mark',
address : 'mark@gmail.com',
type : 'cc'
}, {
connector : 'ftp',
name : 'wiki',
address : 'wiki@gmail.com',
type : 'bcc'
},
{
connector : 'smtp',
name : 'wiki',
address : 'wiki@gmail.com',
type : 'cc'
}
]
I need the output like the following way
output = [{
connector : 'smtp',
name : 'john',
address : 'john@gmail.com',
type : 'cc'
},{
connector : 'gtp',
name : 'mark',
address : 'mark@gmail.com',
type : 'cc'
}, {
connector : 'ftp',
name : 'wiki',
address : 'wiki@gmail.com',
type : 'bcc'
},
{
connector : 'smtp',
name : 'wiki',
address : 'wiki@gmail.com',
type : 'cc'
}
]
Sorry i tried some repeated foreach looping but ended up no where. Could you help me to find any efficient way of doing the same.