Skip to main content
Module

x/rambda/ifElse.js

Faster and smaller alternative to Ramda
Go to Latest
File
import { curry } from './curry'
function ifElseFn( condition, onTrue, onFalse){ return (...input) => { const conditionResult = typeof condition === 'boolean' ? condition : condition(...input)
if (conditionResult === true){ return onTrue(...input) }
return onFalse(...input) }}
export const ifElse = curry(ifElseFn)