Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

union.js 749B

1234567891011121314151617181920212223242526
  1. var baseFlatten = require('./_baseFlatten'),
  2. baseRest = require('./_baseRest'),
  3. baseUniq = require('./_baseUniq'),
  4. isArrayLikeObject = require('./isArrayLikeObject');
  5. /**
  6. * Creates an array of unique values, in order, from all given arrays using
  7. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8. * for equality comparisons.
  9. *
  10. * @static
  11. * @memberOf _
  12. * @since 0.1.0
  13. * @category Array
  14. * @param {...Array} [arrays] The arrays to inspect.
  15. * @returns {Array} Returns the new array of combined values.
  16. * @example
  17. *
  18. * _.union([2], [1, 2]);
  19. * // => [2, 1]
  20. */
  21. var union = baseRest(function(arrays) {
  22. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  23. });
  24. module.exports = union;