Skip to content

Instantly share code, notes, and snippets.

@jpbassalot
Created March 1, 2014 22:09
Show Gist options
  • Save jpbassalot/9298244 to your computer and use it in GitHub Desktop.
Save jpbassalot/9298244 to your computer and use it in GitHub Desktop.
var aaa = [
{name: "AAA", id: 845},
{name: "BBB", id: 839},
{name: "CCC", id: 854}
];
var bbb = [
{id: 839},
{id: 854}
];
var ids = {};
_.each(bbb, function (bb) { ids[bb.id] = true; });
var out = _.filter(aaa, function (val) {
return ids[val.id];
}, bbb);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment