These are chat archives for ramda/ramda

Oct 2018
Nate Abele
Oct 15 2018 15:36
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
Oct 15 2018 15:43
@CrossEye Guessing this one's for you? ^^
Brad Compton (he/him)
Oct 15 2018 16:03
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
Oct 15 2018 16:26
@Bradcomp Cool. I mostly wanted to verify before going and submitting a patch to the TypeScript definitions, which is my real problem. :-)
Konstantin Kostiuk
Oct 15 2018 17:31
how can this be simplified in ramda?
Konstantin Kostiuk
Oct 15 2018 17:37
const reducer = (state, action)=> compose(
    s=>tickOutcome(s, action),
    s=>tickIncome(s, action),
    s=>keyboardCtrl(s, action),
    s=>playerCtrl(s, action),
)(state, action));
Oct 15 2018 20:35
R.propSatisfies(x => x, 'x', {x: 1, y: 2});

behaves the same as

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


Riku Tiira
Oct 15 2018 20:42
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
Oct 15 2018 20:44
[1] true! R.propSatisfies(x => x, 'x', {x: 1, y: 2}); is as good as {x:1,y:2}['x']
Ben Briggs
Oct 15 2018 21:03
^ For that you probably want R.prop('x', {x:1, y:2})
Denis Stoyanov
Oct 15 2018 21:06
@SET001 flip your functions in reducer. More semantically use this order for arguments tickOutcome(action, s)
const reducer = action => compose(
also use curryN in your functions
or just action => state => ...