This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Support $cond and $select in expressions (or termary) #156
Closed
Description
Often you want to choose two things based on a predicate but there's no ternary operator so people just hack around it with {true: 'value1', false: 'value2'}[!!checkFunction()] which is far less readable.
Support:
$cond(checkFunction(), 'value1', 'value2')
$select(keyFunction(), {key1:'value1', key2: 'value2'})
Supporting a true ternary operator makes conditional function calls a little too easy, but supporting function forms of the operations means you get the same end result without that problem.