Module

x/rambda/immutable.d.ts>ifElse

Faster and smaller alternative to Ramda
Go to Latest
function ifElse
import { ifElse } from "https://dotland.deno.dev/x/rambda@v9.2.0/immutable.d.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 readonly any[]
TOnTrueResult
TOnFalseResult

Parameters

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