Skip to main content
Module

x/ramda/mod.ts>cond

:ram: Practical functional Javascript
Latest
variable cond
import { cond } from "https://deno.land/x/ramda@v0.27.2/mod.ts";

Returns a function, fn, which encapsulates if/else, if/else, ... logic. R.cond takes a list of [predicate, transformer] pairs. All of the arguments to fn are applied to each of the predicates in turn until one returns a "truthy" value, at which point fn returns the result of applying its arguments to the corresponding transformer. If none of the predicates matches, fn returns undefined.