deno.land / x / rambda@v9.1.1 / src / maybe.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { type } from './type.js'
export function maybe( ifRule, whenIf, whenElse){ const whenIfInput = ifRule && type(whenIf) === 'Function' ? whenIf() : whenIf
const whenElseInput = !ifRule && type(whenElse) === 'Function' ? whenElse() : whenElse
return ifRule ? whenIfInput : whenElseInput}
rambda

Version Info

Tagged at
2 months ago