blob: 1f9c0b30c6a94081f31dab01f99fe167d66390ed [file] [log] [blame]
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
}