How to use the unionWith function from ramda

Find comprehensive JavaScript ramda.unionWith code examples handpicked from public code repositorys.

132
133
134
135
136
137
138
139
140
141
142
 * @param arr1
 * @param arr2
 * @returns {*}
 */
export function unionMenus(arr1, arr2) {
  const bb = R.unionWith(R.eqBy(R.prop('menuName')), arr1, arr2);
  const result = [...arr1, ...R.difference(bb, arr1)];


  return result;
}
fork icon1
star icon0
watch icon0

90
91
92
93
94
95
96
97
98
99
return new Promise((resolve) => {
  importExistingBankFacts().then((existingTransactions) => {
    importNewBankFacts().then((newTransactions) => {
      const allFacts = R.reverse(R.sortBy(
        R.prop('timestamp'),
        R.unionWith(R.eqBy(R.prop('id')), existingTransactions, newTransactions),
      ));
      exportBankFacts(allFacts);
      logger.info(`Imported ${allFacts.length} bankFacts`);
      resolve(allFacts);
fork icon0
star icon0
watch icon0

6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
 * @see R.union
 * @example
 *
 *      var l1 = [{a: 1}, {a: 2}];
 *      var l2 = [{a: 1}, {a: 4}];
 *      R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}]
 */
var unionWith = _curry3(function unionWith(pred, list1, list2) {
    return uniqWith(pred, _concat(list1, list2));
});
fork icon0
star icon0
watch icon0

+ 17 other calls in file

Other functions in ramda

Sorted by popularity

function icon

ramda.clone is the most popular function in ramda (30311 examples)