Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Created January 1, 2013 20:39
Show Gist options
  • Select an option

  • Save hughfdjackson/4429869 to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/4429869 to your computer and use it in GitHub Desktop.
var intersectWith = function(a, b, fn){
return a.filter(function(i){
return b.some(fn.bind(null, i))
})
}
intersectWith([1, 2, 3, 4], [{id: 3}], function(a, b){ return a == b.id })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment