source: node_modules/ramda/es/symmetricDifferenceWith.js@ d24f17c

main
Last change on this file since d24f17c 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]1import _curry3 from "./internal/_curry3.js";
2import concat from "./concat.js";
3import differenceWith from "./differenceWith.js";
4/**
5 * Finds the set (i.e. no duplicates) of all elements contained in the first or
6 * second list, but not both. Duplication is determined according to the value
7 * returned by applying the supplied predicate to two list elements.
8 *
9 * @func
10 * @memberOf R
11 * @since v0.19.0
12 * @category Relation
13 * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a]
14 * @param {Function} pred A predicate used to test whether two items are equal.
15 * @param {Array} list1 The first list.
16 * @param {Array} list2 The second list.
17 * @return {Array} The elements in `list1` or `list2`, but not both.
18 * @see R.symmetricDifference, R.difference, R.differenceWith
19 * @example
20 *
21 * const eqA = R.eqBy(R.prop('a'));
22 * const l1 = [{a: 1}, {a: 2}, {a: 3}, {a: 4}];
23 * const l2 = [{a: 3}, {a: 4}, {a: 5}, {a: 6}];
24 * R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}]
25 */
26
27var symmetricDifferenceWith =
28/*#__PURE__*/
29_curry3(function symmetricDifferenceWith(pred, list1, list2) {
30 return concat(differenceWith(pred, list1, list2), differenceWith(pred, list2, list1));
31});
32
33export default symmetricDifferenceWith;
Note: See TracBrowser for help on using the repository browser.