As you can see in the image below, I have returned json datawith three objects; each contains id => customer identifiers.

exact_match : {104}
match_4 : {104, 103}
match_2 : {104, 103, 68}
How can I “crop” or delete duplicate objects based on previous ones? sort of:
exact_match : {104}
match_4 : {103}
match_2 : {68}
I tried _. difference , but it didn’t work (maybe because these are not arrays, but objects?):
var exact_match = data.exact_match,
match_four_digits = _.difference(data.match_4, data.exact_match),
match_two_digits = _.difference(data.match_2, data.exact_match, data.match_4),
Any help would be appreciated :)
Update
I need the return value to have the same object data instead of a new array :)
source
share