How to use the difference function from ramda

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

1016
1017
1018
1019
1020
1021
1022
1023
1024
1025

debug(`peer ${peer.host} is known to network, received ${headers.length} headers`);

// store all the header hashes so that we're able to get the interval till the tip of the chain
// difference is here to only store missing items - these will arrive from multiple peers
const store = difference(headers, this._initialSyncHeaderHashes);
debug(`storing ${store.length} headers - this was the difference between already known and received`);
this._initialSyncHeaderHashes = concat(this._initialSyncHeaderHashes, store);

// if we received 2000 headers - we need to loop again using starts: headers.last, stop: zeroes, until the number is smaller
fork icon12
star icon5
watch icon7

290
291
292
293
294
295
296
297
298
299
var _this = this;

var nextKeys = R.keys(nextCatalog).map(String);
return R.mapObjIndexed(function (prevCatalog, locale) {
  var prevKeys = R.keys(prevCatalog).map(String);
  var newKeys = R.difference(nextKeys, prevKeys);
  var mergeKeys = R.intersection(nextKeys, prevKeys);
  var obsoleteKeys = R.difference(prevKeys, nextKeys); // Initialize new catalog with new keys

  var newMessages = R.mapObjIndexed(function (message, key) {
fork icon1
star icon0
watch icon0

+ 3 other calls in file

8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
 * @return {Array} The elements in `list1` that are not in `list2`.
 * @see R.differenceWith, R.symmetricDifference, R.symmetricDifferenceWith
 * @example
 *
 *      R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2]
 *      R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5]
 */
var difference = _curry2(function difference(first, second) {
    var out = [];
    var idx = 0;
fork icon0
star icon0
watch icon0

+ 35 other calls in file

2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
 * @see R.differenceWith, R.symmetricDifference, R.symmetricDifferenceWith, R.without
 * @example
 *
 *      R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2]
 *      R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5]
 *      R.difference([{a: 1}, {b: 2}], [{a: 1}, {c: 3}]) //=> [{b: 2}]
 */




var difference =
fork icon0
star icon0
watch icon2

+ 11 other calls in file

Other functions in ramda

Sorted by popularity

function icon

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