How to use the findLast function from ramda

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

96
97
98
99
100
101
102
103
104
105
106
const getEventByKey = async (adminId, slug, field = 'fanUrl') => {
  const snapshot = await db.ref('events').orderByChild(field).equalTo(slug).once('value');
  if (snapshot.numChildren()) {
    const events = Object.values(snapshot.val());
    // Filtering by adminId
    return R.findLast(R.propEq('adminId', adminId))(events);
  }


  return null;
};
fork icon12
star icon5
watch icon0

2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
 * @return {Object} The element found, or `undefined`.
 * @see R.transduce
 * @example
 *
 *      var xs = [{a: 1, b: 0}, {a:1, b: 1}];
 *      R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1}
 *      R.findLast(R.propEq('a', 4))(xs); //=> undefined
 */
var findLast = _curry2(_dispatchable('findLast', _xfindLast, function findLast(fn, list) {
    var idx = list.length - 1;
fork icon0
star icon0
watch icon0

+ 35 other calls in file

Other functions in ramda

Sorted by popularity

function icon

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