OPTION 1 , simple js
I would suggest converting each of the lists into a set by id, for example.
{1: {x: 1, y: 1}, 2: {x: 2, y: 2}}
Then run over one (or both) sets and create a new dictionary with the attributes of the two - this last bit depends on whether you are looking for an internal or external connection. This should lead to approximately linear runtime, the implementation of javascript dictionaries is quite effective.
OPTION 2 , underscore, for dense sets of identifiers using _.zip ()
If id relatively dense and you want the outer join to know in advance that the sets of identifiers are the same, another option is to stuff the data into three arrays - one for each attribute and then use the underscore method zip ().
OPTION 3 , underscore using _.groupBy ()
Another opportunity to run _.groupBy () on lists that you have is using a special comparison method, which will also allow you to connect to multiple keys. However, simple post-processing will be required since the direct result will be a dictionary of the word
{1: [{'id':'1', 'x':'1', 'y':'2'}, {'id':'1', 'z':'1'}], 2: [{'id':'2', 'x':'2', 'y':'2'}, {'id':'2', 'z':'2'}]}
The internal behavior of the connection in the latter case can be achieved by filtering these elements in the resulting dictionary that do not have the maximum number of elements in the list (2, in the example).