Skip to main content
Module

x/rambda/maybe.js

Faster and smaller alternative to Ramda
Go to Latest
File
import { type } from './type'
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}