I've seen a lot of examples that show how to filter/remove duplicate values from array, but I want to get the duplicates and use them in a new array. So for
array = [
{ id: '1', description: 'foo'},
{ id: '2', description: 'bar'},
{ id: '3', description: 'bloop'},
{ id: '1', description: 'bleep'}
]
I want a new array returned that only contains items with matching Id's like so
[
{ id: '1', description: 'foo'},
{ id: '1', description: 'bleep'}
]
I feel like this should be easier than I'm making it
Edit: The suggestions do not do what I'm asking for. They are either creating lookup tables or removing the items from the original array.