Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rambda/rambda.js>when

Faster and smaller alternative to Ramda
Go to Latest
function when
import { when } from "https://deno.land/x/rambda@9.3.0/rambda.js";

It pass input to predicate function and if the result is true, it will return the result of whenTrueFn(input). If the predicate returns false, then it will simply return input.

Parameters

predicate: (x: T) => boolean
whenTrueFn: (a: T) => U
input: T

Parameters

predicate: (x: T) => boolean
whenTrueFn: (a: T) => U

Returns

(input: T) => T | U

Parameters

predicate: (x: T) => boolean

Returns

((whenTrueFn: (a: T) => U) => (input: T) => T | U)