These are chat archives for ramda/ramda

18th
Sep 2018
Baqer Mamouri
@bmamouri
Sep 18 2018 04:31

How can I use the placeholder function (R.__) to pass the a value to inner function:

var realtime = [{homeId: 1, c: 10}, {homeId: 2, c: 10}]

R.or(
  R.find(
    R.propEq('homeId', 3)
  ), null
)(realtime)

I want to pass the realtime value to R.find rather than R.or

Ben Briggs
@ben-eb
Sep 18 2018 07:51
@bmamouri R.or takes two expressions, so you can do:
R.or(
  R.find(
    R.propEq('homeId', 3)
  )(realtime),
  null
)
Ben Briggs
@ben-eb
Sep 18 2018 10:41
@bmamouri If you wanted to pass the value to both inner functions, keeping the same behaviour:
R.either(
  R.find(R.propEq('homeId', 3)),
  R.always(null)
)(realtime)
Alex Deas
@alex-deas_gitlab
Sep 18 2018 15:13
Hey peoples, was R.__ removed in a previous version?
Ben Briggs
@ben-eb
Sep 18 2018 15:34
@alex-deas_gitlab Hello - nope, it's a bug with the docs
Alex Deas
@alex-deas_gitlab
Sep 18 2018 15:38
Ah ok, also seems to be missing off the definitelyTyped types as well