Reputation: 882
I have the following if statement:
var formatCity =
obj => R.both(has('city'), has('state'))(obj) ? appendCommaToCity(obj) : obj
I would like to make this code point free, but can not figure out a way around the if statement.
Upvotes: 0
Views: 63
Reputation: 664538
That's quite simple actually using the ifElse
function - or its specialisation, when
:
const formatCity = R.when(R.both(has('city'), has('state')), appendCommaToCity);
Upvotes: 5