Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

123456789101112131415161718192021222324252627282930
  1. var arrayMap = require('./_arrayMap'),
  2. baseIntersection = require('./_baseIntersection'),
  3. baseRest = require('./_baseRest'),
  4. castArrayLikeObject = require('./_castArrayLikeObject');
  5. /**
  6. * Creates an array of unique values that are included in all given arrays
  7. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  8. * for equality comparisons. The order and references of result values are
  9. * determined by the first array.
  10. *
  11. * @static
  12. * @memberOf _
  13. * @since 0.1.0
  14. * @category Array
  15. * @param {...Array} [arrays] The arrays to inspect.
  16. * @returns {Array} Returns the new array of intersecting values.
  17. * @example
  18. *
  19. * _.intersection([2, 1], [2, 3]);
  20. * // => [2]
  21. */
  22. var intersection = baseRest(function(arrays) {
  23. var mapped = arrayMap(arrays, castArrayLikeObject);
  24. return (mapped.length && mapped[0] === arrays[0])
  25. ? baseIntersection(mapped)
  26. : [];
  27. });
  28. module.exports = intersection;