UNPKG

957 BJavaScriptView Raw
1var _curry2 =
2/*#__PURE__*/
3require("./internal/_curry2");
4
5var concat =
6/*#__PURE__*/
7require("./concat");
8
9var difference =
10/*#__PURE__*/
11require("./difference");
12/**
13 * Finds the set (i.e. no duplicates) of all elements contained in the first or
14 * second list, but not both.
15 *
16 * @func
17 * @memberOf R
18 * @since v0.19.0
19 * @category Relation
20 * @sig [*] -> [*] -> [*]
21 * @param {Array} list1 The first list.
22 * @param {Array} list2 The second list.
23 * @return {Array} The elements in `list1` or `list2`, but not both.
24 * @see R.symmetricDifferenceWith, R.difference, R.differenceWith
25 * @example
26 *
27 * R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); //=> [1,2,7,6,5]
28 * R.symmetricDifference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5,1,2]
29 */
30
31
32var symmetricDifference =
33/*#__PURE__*/
34_curry2(function symmetricDifference(list1, list2) {
35 return concat(difference(list1, list2), difference(list2, list1));
36});
37
38module.exports = symmetricDifference;
\No newline at end of file