How to use the uniqBy function from ramda

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

16
17
18
19
20
21
22
23
24
25
26
  R.map(tune => ({
    id: tune.tune,
    type: tune.type,
    names: [tune.name],
  })),
  R.uniqBy(R.prop('id')),
  R.indexBy(R.prop('id'))
)


const transformAliases = R.pipe(R.groupBy(R.prop('tune_id')), R.map(R.pluck('alias')))
fork icon0
star icon4
watch icon0

8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
 * @param {Function} fn A function used to produce a value to use during comparisons.
 * @param {Array} list The array to consider.
 * @return {Array} The list of unique items.
 * @example
 *
 *      R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10]
 */
var uniqBy = _curry2(function uniqBy(fn, list) {
    var set = new _Set();
    var result = [];
fork icon0
star icon0
watch icon0

+ 17 other calls in file

198
199
200
201
202
203
204
205
206
207
 * @returns {Promise<Entity[]>} same as input but deduplicated
 */
dedupe = (by) => async (input) => {
    input = toArray(input)

    return R.uniqBy(R.prop(by))(input)
}

/**
 * Tries to sort values in a way that puts similar items further away from
fork icon0
star icon0
watch icon0

Other functions in ramda

Sorted by popularity

function icon

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