Skip to content

Instantly share code, notes, and snippets.

@jashkenas
Created November 23, 2011 20:56
Show Gist options
  • Select an option

  • Save jashkenas/1389888 to your computer and use it in GitHub Desktop.

Select an option

Save jashkenas/1389888 to your computer and use it in GitHub Desktop.
// Take the symmetric difference between a list of arrays. Only the elements
// present in one of the input arrays will remain.
_.symDifference = function() {
return _.reduce(arguments, function(memo, array) {
return _.union(_.difference(memo, array), _.difference(array, memo));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment