difference.js 481 B

1234567891011121314
  1. define(['./restArguments', './_flatten', './filter', './contains'], function (restArguments, _flatten, filter, contains) {
  2. // Take the difference between one array and a number of other arrays.
  3. // Only the elements present in just the first array will remain.
  4. var difference = restArguments(function(array, rest) {
  5. rest = _flatten(rest, true, true);
  6. return filter(array, function(value){
  7. return !contains(rest, value);
  8. });
  9. });
  10. return difference;
  11. });