a-synchronous / a-synchronous/rubico
rubico/x/ternary
- Lingua principale
- JavaScript
- Stelle
- 283
- Fork
- 17
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
must use `switchCase`
### ternary
like `switch`, but takes exactly three functions sans array
```javascript
y = ternary(ifFunc, doFunc, elseFunc)(x)
```
`ifFunc` is a predicate function that determines execution of `doFunc` or `elseFunc`
`doFunc` is a function that is executed on `ifFunc` truthy
`elseFunc` is a function that is executed on `ifFunc` falsy
y is either `doFunc(x)` or `elseFunc(x)` depending on `ifFunc(x)`
```javascript
const isOdd = x => x % 2 === 1
ternary(
isOdd, () => 'odd',
() => 'even',
)
```
TODO
* [ ] - [documentation entry](https://github.com/a-synchronous/rubico/tree/master/x#documentation)
* [ ] - implementation + tests
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.