De-Duplicating JavaScript Array of Objects

Yesterday I found I needed to de-duplicate an array of objects. The problem is, I needed to compare the objects in their entirety, not just by an individual key. I was quite surprised to find something was not already written up, and shared, on the interwebs.

Maybe it’s rare that one needs to get a unique array of objects by comparing the entire object. Or maybe it’s not very performant so folks don’t bother. Either way, here’s what I came up with. I hope you find it helpful. If you come up with a better method, please do let me know.

JS Bin

RedditDeliciousEvernoteTumblrLinkedInStumbleUponPinterestDiggGoogle+Share/Bookmark

2 thoughts on “De-Duplicating JavaScript Array of Objects”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>