Skip to content

Instantly share code, notes, and snippets.

@yhahn
Created April 16, 2011 18:34
Show Gist options
  • Save yhahn/923378 to your computer and use it in GitHub Desktop.
Save yhahn/923378 to your computer and use it in GitHub Desktop.
var usedCoordinates = [ { x: 10, y: 5 }, { x: 10, y: 6 }, { x: 10, y: 7 } ];
var coordinates = [ { x: 10, y: 7 }, { x: 10, y: 8 } ];
// Should be [ { x: 10, y: 7 } ]
var intersection = _.select(coordinates, function(element){
return _.any(usedCoordinates, function(otherElement){
return _.isEqual(element, otherElement);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment