cond-flow
Inspired bei Elixir's cond
(see case-cond-and-if) this is a simpler alternative to _.cond
from lodash
Install
Install with npm or yarn via
yarn add cond-flow
or
npm i cond-flow
Usage
import cond from 'cond-flow'
const value = cond([
[false, 'false'],
[true, 'true'],
[true, 'true but too late']
])
You can disable strict checking by passing options as the second argument:
import cond from 'cond-flow'
const value = cond(
[
[false, 'false'],
[1, 'truthy'],
[true, 'true but also too late']
],
{ strict: false }
)
Development
If you find this useful or would like to add features, feel free to clone the repository and open a PR.