jashkenas/underscore — pull request #1195 by bensisson (2013-07-09 07:39:57+00:00)
Title: Join function for arrays

Example usage.

var list1 = [
{
id: 1,
columnA: "column A"
},
{
id: 2,
columnA: "column A"
}
];

var list2 = [
{
id: 1,
columnB: "column B"
},
{
id: 2,
columnB: "column B"
}
];

var list3 = [
{
id: 1,
columnC: "column C"
},
{
id: 2,
columnC: "column C"
}
];

var join = _.join(list1, list2, list3, function (l1, l2) {
return l1.id === l2.id;
});

join = [
{
id: 1,
columnA: "column A",
columnB: "column B",
columnC: "column C"
},
{
id: 2,
columnA: "column A",
columnB: "column B",
columnC: "column C"
}
];

https://github.com/jashkenas/underscore/issues/1194