Skip to main content
Module

x/fae/when.ts>when

A functional module for Deno inspired from Ramda.
Latest
variable when
import { when } from "https://deno.land/x/fae@v1.1.1/when.ts";

Applies func on value if the test predicate is true and returns it; returns value otherwise.

 const truncate = Fae.when(
   Fae.propSatisfies(Fae.gt(Fae._, 10), 'length'),
   Fae.pipe(Fae.take(10), Fae.append('…'), Fae.join(''))
 );
 truncate('12345');         //=> '12345'
 truncate('0123456789ABC'); //=> '0123456789…'

type

When