How to use the pluck function from ramda

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

67
68
69
70
71
72
73
74
75
76
77
78


  return monkeys
})


const getMonkeyBusiness = R.pipe(
  R.pluck('inspected'),
  R.values,
  R.sort(R.descend(R.identity)),
  R.take(2),
  R.apply(R.multiply),
fork icon0
star icon1
watch icon0

113
114
115
116
117
118
119
120
121
let students = ['Rosser', 'Turing', 'Kleene', 'Church'];
let grades = [80, 100, 90, 99];

const smartestStudent = R.compose(
    R.head,
    R.pluck(0),
    R.reverse,
    R.sortBy(R.prop(1)),
    R.zip);
fork icon0
star icon0
watch icon1

97
98
99
100
101
102
103
104
105
106
107
108


const part1 = R.compose(
  R.apply(R.multiply),
  R.takeLast(2),
  R.sort(R.subtract),
  R.pluck('inspects'),
  R.reduce(runRound(Infinity), R.__, Array(20))
)(monkeys1)


const part2 = R.compose(
fork icon0
star icon0
watch icon0

+ 7 other calls in file

6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
 * @return {Array} The list of values for the given key.
 * @see R.props
 * @example
 *
 *      R.pluck('a')([{a: 1}, {a: 2}]); //=> [1, 2]
 *      R.pluck(0)([[1, 2], [3, 4]]);   //=> [1, 3]
 */
var pluck = _curry2(function pluck(p, list) {
    return map(prop(p), list);
});
fork icon0
star icon0
watch icon0

+ 35 other calls in file

97
98
99
100
101
102
103
104
105
106
107


//  abortIfNotSorted :: List[{*}] -> List[{*}]
var abortIfNotSorted = R.tap(R.cond([[
  R.complement(R.pipe(
      R.pluck('id'),
      R.pluck('name'),
      R.converge(R.equals, R.identity, R.sortBy(R.identity))
    )),
  R.pipe(
      R.path(['0', 'loc', 'source']),
fork icon0
star icon0
watch icon0

+ 2 other calls in file

39
40
41
42
43
44
45
46
47
48
49
50


//@emandrada style!
const combinationsFor = (target, memo) =>
  R.pipe(
    R.filter(({ value }) => value + 3 >= target),
    R.pluck("combinations"),
    R.sum
  )(memo)


const combinations = R.reduce(
fork icon0
star icon0
watch icon0

68
69
70
71
72
73
74
75
76
77
78
  `
  const result = await api.export(client, sql)
  if (R.type(result) !== "Array") {
    throw new Error("Could not fetch contact relationtypes")
  }
  return R.pluck("relationtypeid", result)  
}


exports.getCreditInfo = async function(client, contactid, filter = null) {
    const l = client.language
fork icon0
star icon0
watch icon0

+ 2 other calls in file

11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
* @param {Array} f The array or functor to consider.
* @return {Array} The list of values for the given key.
* @see R.props
* @example
*
*      var getAges = R.pluck('age');
*      getAges([{name: 'fred', age: 29}, {name: 'wilma', age: 27}]); //=> [29, 27]
*
*      R.pluck(0, [[1, 2], [3, 4]]);               //=> [1, 3]
*      R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5}
fork icon0
star icon0
watch icon2

+ 19 other calls in file

7
8
9
10
11
12
13
14
15
16
17
function trackPushNotification(notification, user) {
  return Mixpanel.track({ name: 'Push Notification Sent', data: notification.data }, user.id);
}


const createEmailChunks = (users, emailsInChunk = 100) => R.pipe(
  R.pluck('email'),
  R.reject(R.isNil),
  R.splitEvery(emailsInChunk)
)(users);

fork icon0
star icon0
watch icon0

26
27
28
29
30
31
32
33
34
    return 1;
  } else {
    return R.compose(
      R.inc,
      R.apply(Math.max),
      R.pluck('id')
    )(items);
  }
};
fork icon0
star icon0
watch icon0

+ 3 other calls in file

109
110
111
112
113
114
115
116
117
118
119
120


  console.log(R.compose(
    R.reduce(R.multiply, 1),
    R.take(2),
    R.sort(R.flip(R.subtract)),
    R.pluck('inspectionCount')
  )(monkeyList))
}


application()
fork icon0
star icon0
watch icon0

61
62
63
64
65
66
67
68
69
70
71
72
instruction$.subscribe((instructions) => {
  const firstRunState = runProgram(instructions)
  reportError(firstRunState)
  console.log("Looking for a fix")


  const positionsToTry = R.pluck("cursor", firstRunState.history)


  const tryFix = (acc, positionToTry) => {
    const newProgram = flipOperation(instructions, positionToTry)
    if (newProgram) {
fork icon0
star icon0
watch icon0

50
51
52
53
54
55
56
57
58
59

const columns = R.compose(
  R.prepend(
    R.compose(
      R.prepend('x'),
      R.pluck(0)
    )(series[0])
  ),
  series => R.append(
    others(limit)(otherLabel)(series),
fork icon0
star icon0
watch icon1

+ 3 other calls in file

Other functions in ramda

Sorted by popularity

function icon

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