source: node_modules/ramda/src/unionWith.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[d24f17c]1var _concat =
2/*#__PURE__*/
3require("./internal/_concat.js");
4
5var _curry3 =
6/*#__PURE__*/
7require("./internal/_curry3.js");
8
9var uniqWith =
10/*#__PURE__*/
11require("./uniqWith.js");
12/**
13 * Combines two lists into a set (i.e. no duplicates) composed of the elements
14 * of each list. Duplication is determined according to the value returned by
15 * applying the supplied predicate to two list elements. If an element exists
16 * in both lists, the first element from the first list will be used.
17 *
18 * @func
19 * @memberOf R
20 * @since v0.1.0
21 * @category Relation
22 * @sig ((a, a) -> Boolean) -> [*] -> [*] -> [*]
23 * @param {Function} pred A predicate used to test whether two items are equal.
24 * @param {Array} list1 The first list.
25 * @param {Array} list2 The second list.
26 * @return {Array} The first and second lists concatenated, with
27 * duplicates removed.
28 * @see R.union
29 * @example
30 *
31 * const l1 = [{a: 1}, {a: 2}];
32 * const l2 = [{a: 1}, {a: 4}];
33 * R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}]
34 */
35
36
37var unionWith =
38/*#__PURE__*/
39_curry3(function unionWith(pred, list1, list2) {
40 return uniqWith(pred, _concat(list1, list2));
41});
42
43module.exports = unionWith;
Note: See TracBrowser for help on using the repository browser.