Add support for custom comparator function

This is quite useful when dealing with sets of non-trivial `JSON` objects that don't have an `.equals(other)` (e.g.: an data endpoint response), and adding an `.equals(other)` method is not an option in such a scenario (you'd be overriding `Object`'s prototype).