These are chat archives for ramda/ramda

15th
Oct 2018
Nate Abele
@nateabele
Oct 15 2018 15:36 UTC
Question about replace: since it just dispatches to String.prototype.replace(), the second parameter is allowed to be a function, but it's not documented that way. Is that intentionally not guaranteed behavior, or just an oversight?
Nate Abele
@nateabele
Oct 15 2018 15:43 UTC
@CrossEye Guessing this one's for you? ^^
Brad Compton (he/him)
@Bradcomp
Oct 15 2018 16:03 UTC
There was an issue or PR related to that recently, but I am struggling to find it
I think we are updating the documentation just to mention that it dispatches to String.prototype.replace
Nate Abele
@nateabele
Oct 15 2018 16:26 UTC
@Bradcomp Cool. I mostly wanted to verify before going and submitting a patch to the TypeScript definitions, which is my real problem. :-)
Konstantin Kostiuk
@SET001
Oct 15 2018 17:31 UTC
how can this be simplified in ramda?
Konstantin Kostiuk
@SET001
Oct 15 2018 17:37 UTC
const reducer = (state, action)=> compose(
    s=>tickOutcome(s, action),
    s=>tickIncome(s, action),
    s=>keyboardCtrl(s, action),
    s=>playerCtrl(s, action),
)(state, action));
hemanth.hm
@hemanth
Oct 15 2018 20:35 UTC
R.propSatisfies(x => x, 'x', {x: 1, y: 2});

behaves the same as

R.props('x')({x:1, y:2})

?

Riku Tiira
@rikutiira
Oct 15 2018 20:42 UTC
Not quite, R.props returns [1] in your case, whereas R.propSatisfies returns 1, which is actually undocumented feature since it should return a boolean but it seems like it doesn’t do any coercion of its own
hemanth.hm
@hemanth
Oct 15 2018 20:44 UTC
[1] true! R.propSatisfies(x => x, 'x', {x: 1, y: 2}); is as good as {x:1,y:2}['x']
Ben Briggs
@ben-eb
Oct 15 2018 21:03 UTC
^ For that you probably want R.prop('x', {x:1, y:2})
Denis Stoyanov
@xgrommx
Oct 15 2018 21:06 UTC
@SET001 flip your functions in reducer. More semantically use this order for arguments tickOutcome(action, s)
const reducer = action => compose(
    tickOutcome(action),
    tickIncome(action),
    keyboardCtrl(action),
    playerCtrl(action)
)
also use curryN in your functions
or just action => state => ...