union.js 385 B

12345678910111213141516171819
  1. var unique = require('./unique');
  2. var append = require('./append');
  3. /**
  4. * Concat multiple arrays and remove duplicates
  5. */
  6. function union(arrs) {
  7. var results = [];
  8. var i = -1, len = arguments.length;
  9. while (++i < len) {
  10. append(results, arguments[i]);
  11. }
  12. return unique(results);
  13. }
  14. module.exports = union;