Module

x/rambda/mod.ts>ifElse

Faster and smaller alternative to Ramda
Latest
function ifElse
import { ifElse } from "https://dotland.deno.dev/x/rambda@9.4.1/mod.ts";

It expects condition, onTrue and onFalse functions as inputs and it returns a new function with example name of fn.

When fn`` is called with inputargument, it will return eitheronTrue(input)oronFalse(input)depending oncondition(input)` evaluation.

Type Parameters

T
TFiltered extends T
TOnTrueResult
TOnFalseResult

Parameters

pred: (a: T) => a is TFiltered
onTrue: (a: TFiltered) => TOnTrueResult
onFalse: (a: Exclude<T, TFiltered>) => TOnFalseResult

Type Parameters

TArgs extends any[]
TOnTrueResult
TOnFalseResult

Parameters

fn: (...args: TArgs) => boolean
onTrue: (...args: TArgs) => TOnTrueResult
onFalse: (...args: TArgs) => TOnFalseResult