difference.js 469 B

12345678910111213
  1. import restArguments from './restArguments.js';
  2. import flatten from './_flatten.js';
  3. import filter from './filter.js';
  4. import contains from './contains.js';
  5. // Take the difference between one array and a number of other arrays.
  6. // Only the elements present in just the first array will remain.
  7. export default restArguments(function(array, rest) {
  8. rest = flatten(rest, true, true);
  9. return filter(array, function(value){
  10. return !contains(rest, value);
  11. });
  12. });