union.js 692 B

1234567891011121314151617181920212223242526272829
  1. import _concat from "./internal/_concat.js";
  2. import _curry2 from "./internal/_curry2.js";
  3. import compose from "./compose.js";
  4. import uniq from "./uniq.js";
  5. /**
  6. * Combines two lists into a set (i.e. no duplicates) composed of the elements
  7. * of each list.
  8. *
  9. * @func
  10. * @memberOf R
  11. * @since v0.1.0
  12. * @category Relation
  13. * @sig [*] -> [*] -> [*]
  14. * @param {Array} as The first list.
  15. * @param {Array} bs The second list.
  16. * @return {Array} The first and second lists concatenated, with
  17. * duplicates removed.
  18. * @example
  19. *
  20. * R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4]
  21. */
  22. var union =
  23. /*#__PURE__*/
  24. _curry2(
  25. /*#__PURE__*/
  26. compose(uniq, _concat));
  27. export default union;