如何使 if 语句无意义
How to make an if statement point free
我有以下 if 语句:
var formatCity =
obj => R.both(has('city'), has('state'))(obj) ? appendCommaToCity(obj) : obj
我想免费提供此代码点,但找不到绕过 if 语句的方法。
实际上使用 ifElse
function - or its specialisation, when
:
非常简单
const formatCity = R.when(R.both(has('city'), has('state')), appendCommaToCity);
我有以下 if 语句:
var formatCity =
obj => R.both(has('city'), has('state'))(obj) ? appendCommaToCity(obj) : obj
我想免费提供此代码点,但找不到绕过 if 语句的方法。
实际上使用 ifElse
function - or its specialisation, when
:
const formatCity = R.when(R.both(has('city'), has('state')), appendCommaToCity);