_.difference should perform a shallow flatten

This commit is contained in:
Michael Ficarra
2012-02-06 12:24:13 -05:00
parent f4359d9684
commit ff544ae997

View File

@@ -403,7 +403,7 @@
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
_.difference = function(array) {
var rest = _.flatten(slice.call(arguments, 1));
var rest = _.flatten(slice.call(arguments, 1), true);
return _.filter(array, function(value){ return !_.include(rest, value); });
};