These are chat archives for ramda/ramda

11th
Jul 2018
Colin Kahn
@colinkahn
Jul 11 2018 19:18
What is a good pattern for adding conditionals within a pipe based on something other than the piped value?
Mike Lambert
@lax4mike
Jul 11 2018 19:19
a ternary expression?
Colin Kahn
@colinkahn
Jul 11 2018 19:21
Is that the best option? Put a ternary choosing between what functions to pipe into?
Rocky Madden
@rockymadden
Jul 11 2018 19:51
I was going to say the alternation combinator but that would work with the value. Is this something that could be in a thunk using something in scope?
Might need to see an example.
Ben Briggs
@ben-eb
Jul 11 2018 21:52
@colinkahn Don't know what you're trying to do exactly but you can use always to swap in some other variable
compose(
  when(
    compose(equals(50), always(someOtherVar)),
    always('satisfied condition')
  )
)(42)
Most of the time when I'm doing something like this I'll use converge and let one of the branching functions reference some other variable, then join them all back up again with the converging function